Baixe o app para aproveitar ainda mais
Prévia do material em texto
EXERCICIO 03 ECONOMETRIA DE SERIES TEMPORAIS Econometria de series temporais Amanda Steffany da silva Araujo Ciências econômicas Noite EXERCÍCIO 03 Seja o banco de dados “quebra”, utilize a variável B1 para: i) fazer o gráfico dos dados; ii) realizar teste ADF; iii) realizar o teste de Perron para quebra estrutural discutido em sala. Realizando o teste: Baixei o arquivo e rodei y <- quebra_dados_exercico_03$B1;y [1] 0.320200 -0.272600 -0.351300 -0.245550 -0.064580 -0.494390 -0.787190 -0.231300 [9] 0.246252 0.473626 0.441513 0.051656 0.424328 0.193964 0.547082 0.292541 [17] 0.345371 0.330885 0.112343 0.016671 0.099936 -0.211130 -0.069070 0.161267 [25] 0.149933 0.054967 0.254983 -0.038110 0.202546 0.622673 0.008936 -0.320930 [33] 0.139434 0.501717 -0.063940 -0.138670 -0.240040 -0.412120 -0.410160 0.064821 [41] -0.104090 0.205455 0.381328 0.572064 0.190532 -0.105330 0.313233 -0.060580 [49] -0.463890 -0.077050 1.063677 1.866639 1.711019 0.179441 1.746205 2.019402 [57] 2.496501 2.219551 2.229775 2.383988 2.357794 2.654697 2.309248 1.974724 [65] 1.857962 1.741781 1.756091 1.999045 2.181823 2.535211 2.392806 1.948903 [73] 1.833851 1.522326 1.616363 2.030281 2.044741 0.176877 2.257085 2.010143 [81] 2.002171 1.619686 1.668243 1.545621 1.810511 1.785255 1.392528 1.815964 [89] 1.996382 1.897291 1.509845 1.681823 1.687011 2.140506 2.413353 1.885376 [97] 1.950988 1.711594 2.058297 1.347049 > plot.ts(y) d1 <- ifelse(y[1:50],0); d2 <- ifelse(y[51:100],1) > DL <- ts(c(d1,d2));# create level dummy > d3 <- ifelse(y[1:49],0); d4 <- ifelse(y[50:50],1); d5 <- ifelse(y[51:100],0) > Dp <- ts(c(d3,d4,d5)); # create pulse dummy > T <- ts(1:100, frequency=1); T; #create trend Time Series: Start = 1 End = 100 Frequency = 1 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [22] 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [43] 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 [64] 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 [85] 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 > library(dyn) > z <- zoo(y) > perr1 <- dyn$lm(z ~ lag(z, -1) + DL + Dp + T) > summary(perr1) Call: lm(formula = dyn(z ~ lag(z, -1) + DL + Dp + T)) Residuals: Min 1Q Median 3Q Max -1.7483 -0.1588 0.0028 0.2241 0.9273 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.060153 0.089191 0.674 0.501699 lag(z, -1) 0.318050 0.088499 3.594 0.000521 *** DL 1.313941 0.212453 6.185 1.6e-08 *** Dp 0.073979 0.397259 0.186 0.852671 T -0.001273 0.002754 -0.462 0.645055 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.3839 on 94 degrees of freedom (1 observation deleted due to missingness) Multiple R-squared: 0.8576, Adjusted R-squared: 0.8516 F-statistic: 141.6 on 4 and 94 DF, p-value: < 2.2e-16 > Dy <- diff(y) > Dz <- zoo(Dy) > Dz <- lag(Dz, c(0,1)) > perr2 <- dyn$lm(z ~ lag(z, -1) + DL + Dp + T + Dz) > summary(perr2) Call: lm(formula = dyn(z ~ lag(z, -1) + DL + Dp + T + Dz)) Residuals: Min 1Q Median 3Q Max -0.67716 -0.15655 0.03202 0.17526 0.54300 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.081158 0.064629 1.256 0.21246 lag(z, -1) 0.184498 0.064828 2.846 0.00548 ** DL 1.550786 0.154694 10.025 2.54e-16 *** Dp 0.946824 0.297305 3.185 0.00199 ** T -0.001259 0.002017 -0.624 0.53416 Dz1 -0.591875 0.064919 -9.117 1.96e-14 *** Dz2 -0.350373 0.061433 -5.703 1.48e-07 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.2724 on 90 degrees of freedom (3 observations deleted due to missingness) Multiple R-squared: 0.9304, Adjusted R-squared: 0.9257 F-statistic: 200.5 on 6 and 90 DF, p-value: < 2.2e-16 > AIC(perr1);AIC(perr2) [1] 98.25387 [1] 31.71127 o resultado mostra que AIC do modelo perr2 é menor e portanto o modelo é melhor.
Compartilhar