Sunteți pe pagina 1din 14

07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.

390)

Econometria: exemplos 10.5 e 12.3 do Wooldridge


(2016, p.390)
Adriano Marcos Rodrigues Figueiredo, *e-mail: adriano.figueiredo@ufms.br*
07 novembro 2018
Abstract
This is an undergrad student level exercise for class use. We analyse data on Barium market, from 1978m02 to
1988m12.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

License: CC BY-SA 4.0

12.3. Wooldridge Source: C.M. Krupp and P.S. Pollard (1999), Market Responses to Antidumpting Laws:
Some Evidence from the U.S. Chemical Industry, Canadian Journal of Economics 29, 199-227. They are
monthly data covering February 1978 through December 1988.

A data.frame with 131 observations on 31 variables:

chnimp: Chinese imports, bar. chl.

bchlimp: total imports bar. chl.

befile6: =1 for all 6 mos before filing

affile6: =1 for all 6 mos after filing

afdec6: =1 for all 6 mos after decision

befile12: =1 all 12 mos before filing

affile12: =1 all 12 mos after filing

afdec12: =1 all 12 mos after decision

chempi: chemical production index

gas: gasoline production

rtwex: exchange rate index

spr: =1 for spring months

sum: =1 for summer months

fall: =1 for fall months

lchnimp: log(chnimp)

lgas: log(gas)

lrtwex: log(rtwex)

lchempi: log(chempi)

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 1/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

t: time trend

feb: =1 if month is feb

mar: =1 if month is march

apr:

may:

jun:

jul:

aug:

sep:

oct:

nov:

dec:

percchn: percent imports from china

Ver também https://justinmshea.github.io/wooldridge/articles/Introductory-Econometrics-


Examples.html e http://www.urfie.net/downloads/12/Example-12-3.R.

> library(dynlm);library(stargazer);library(wooldridge)
> data(barium, package='wooldridge')
> dados=barium
> attach(dados)

Vamos ver como está a tabela importada:

> library(knitr)
> kable(dados[,1:5],caption="Dados do exemplo")

Dados do exemplo

chnimp bchlimp befile6 affile6 afdec6

220.4620 9578.376 0 0 0

94.7980 11219.480 0 0 0

219.3575 9719.900 0 0 0

317.4215 12920.950 0 0 0

114.6390 9790.446 0 0 0

129.5240 11020.470 0 0 0

110.0920 8302.168 0 0 0

39.6830 9583.325 0 0 0

262.8230 9880.729 0 0 0

173.9980 9003.923 0 0 0

548.9455 10153.390 0 0 0

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 2/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

chnimp bchlimp befile6 affile6 afdec6

433.9755 10527.060 0 0 0

213.7855 9238.292 0 0 0

788.6440 11740.390 0 0 0

287.0395 13699.070 0 0 0

278.9545 17716.330 0 0 0

429.8970 15868.760 0 0 0

344.8820 15512.320 0 0 0

538.9150 13831.560 0 0 0

535.7180 13669.760 0 0 0

445.3290 16691.211 0 0 0

649.2550 16617.330 0 0 0

639.3350 15912.760 0 0 0

209.4370 9401.297 0 0 0

512.5915 9195.309 0 0 0

605.3425 11727.520 0 0 0

144.2360 20584.260 0 0 0

405.5360 8929.146 0 0 0

621.1075 10912.110 0 0 0

893.7185 13581.910 0 0 0

140.2300 9218.409 0 0 0

243.4765 20751.770 0 0 0

330.5750 12935.290 0 0 0

46.5860 26984.199 0 0 0

215.1960 18886.381 0 0 0

214.8385 25679.510 0 0 0

238.2085 15502.940 0 0 0

265.6545 18247.141 0 0 0

315.2515 12060.010 0 0 0

426.5905 17777.609 0 0 0

124.7860 14406.150 0 0 0

387.8990 20570.359 0 0 0

400.5400 14210.780 0 0 0

876.8340 15190.780 0 0 0

535.9930 14593.670 0 0 0

815.9555 14044.220 0 0 0

771.8130 10431.430 0 0 0

352.8730 13228.840 0 0 0

431.9340 12801.710 0 0 0

1211.4520 16403.340 0 0 0

575.9175 13591.700 0 0 0

1491.6219 16239.280 0 0 0

380.2920 20010.461 0 0 0

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 3/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

chnimp bchlimp befile6 affile6 afdec6

391.5965 16873.131 0 0 0

505.5120 15379.570 0 0 0

341.0220 10551.650 0 0 0

372.5765 20755.381 0 0 0

483.3590 18066.199 0 0 0

224.0470 17886.760 0 0 0

532.3940 19134.020 0 0 0

239.1405 17455.141 0 0 0

689.4535 18215.721 0 0 0

318.0120 20764.830 1 0 0

1048.0360 28414.789 1 0 0

945.7295 18819.391 1 0 0

295.3720 11737.220 1 0 0

319.4580 12520.280 1 0 0

855.1370 16988.230 1 0 0

671.8070 15835.780 0 0 0

657.9315 17282.949 0 1 0

847.9595 26960.510 0 1 0

849.8735 25137.689 0 1 0

852.9305 19807.490 0 1 0

435.8370 32134.600 0 1 0

204.7075 22954.551 0 1 0

241.5675 24438.789 0 0 0

244.1380 19057.439 0 0 0

656.4015 26784.340 0 0 0

588.0975 37244.379 0 0 0

1128.4440 28129.359 0 0 0

1328.9670 37253.469 0 0 0

227.0635 18289.359 0 0 1

583.2610 14795.910 0 0 1

499.8935 25700.260 0 0 1

165.3460 25240.311 0 0 1

1057.9720 24854.939 0 0 1

465.8225 24119.289 0 0 1

349.4040 27244.980 0 0 0

466.8240 30912.420 0 0 0

717.0470 23173.529 0 0 0

826.7580 29031.439 0 0 0

1571.7360 19400.510 0 0 0

542.9925 29887.711 0 0 0

670.7935 20670.631 0 0 0

430.2755 34375.250 0 0 0

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 4/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

chnimp bchlimp befile6 affile6 afdec6

524.8625 19555.820 0 0 0

317.7500 27362.230 0 0 0

442.8195 31952.500 0 0 0

322.6325 19578.160 0 0 0

742.0795 26605.789 0 0 0

665.3660 20034.420 0 0 0

737.2670 33408.488 0 0 0

1065.2111 20967.311 0 0 0

547.3285 26526.840 0 0 0

1258.4070 28304.020 0 0 0

976.5165 17168.150 0 0 0

1192.6840 12874.300 0 0 0

1047.2390 16153.360 0 0 0

944.7875 15638.680 0 0 0

840.0295 18391.830 0 0 0

578.9175 18786.789 0 0 0

828.1195 17661.711 0 0 0

1010.0570 17623.770 0 0 0

1546.4830 18482.400 0 0 0

1160.1580 21132.420 0 0 0

862.6800 16421.520 0 0 0

692.2970 16128.660 0 0 0

451.3840 14769.440 0 0 0

766.4015 34192.180 0 0 0

1794.5160 17537.230 0 0 0

972.8010 25518.910 0 0 0

738.5085 36649.191 0 0 0

786.1805 18668.000 0 0 0

849.0650 19710.660 0 0 0

895.4205 38521.531 0 0 0

814.3615 19679.381 0 0 0

589.4220 31686.859 0 0 0

529.7335 16370.340 0 0 0

968.0375 15653.960 0 0 0

794.0600 45716.609 0 0 0

1087.8060 29580.500 0 0 0

Estimando o modelo linear de regressao multipla fazendo conforme a expressão do enunciado.

1 Resultados
1.1 Estimação
Fazendo as regressoes com uso de logaritmos.

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 5/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

> tsdata <- ts(dados, start=c(1978,2), frequency=12)


> mod1 <- dynlm(log(chnimp)~log(chempi)+log(gas)+log(rtwex)+
+ befile6+affile6+afdec6, data=tsdata )
> summary(mod1)

Time series regression with "ts" data:


Start = 1978(2), End = 1988(12)

Call:
dynlm(formula = log(chnimp) ~ log(chempi) + log(gas) + log(rtwex) +
befile6 + affile6 + afdec6, data = tsdata)

Residuals:
Min 1Q Median 3Q Max
-2.03356 -0.39080 0.03048 0.40248 1.51720

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -17.80277 21.04537 -0.846 0.3992
log(chempi) 3.11719 0.47920 6.505 1.72e-09 ***
log(gas) 0.19634 0.90662 0.217 0.8289
log(rtwex) 0.98302 0.40015 2.457 0.0154 *
befile6 0.05957 0.26097 0.228 0.8198
affile6 -0.03241 0.26430 -0.123 0.9026
afdec6 -0.56524 0.28584 -1.978 0.0502 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5974 on 124 degrees of freedom


Multiple R-squared: 0.3049, Adjusted R-squared: 0.2712
F-statistic: 9.064 on 6 and 124 DF, p-value: 3.255e-08

> plot(chnimp)

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 6/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

Vamos utilizar o pacote stargazer para organizar as saídas de resultados. Se a saída fosse apenas pelo comando summary, sairia da forma:

> summary(mod1)

Time series regression with "ts" data:


Start = 1978(2), End = 1988(12)

Call:
dynlm(formula = log(chnimp) ~ log(chempi) + log(gas) + log(rtwex) +
befile6 + affile6 + afdec6, data = tsdata)

Residuals:
Min 1Q Median 3Q Max
-2.03356 -0.39080 0.03048 0.40248 1.51720

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -17.80277 21.04537 -0.846 0.3992
log(chempi) 3.11719 0.47920 6.505 1.72e-09 ***
log(gas) 0.19634 0.90662 0.217 0.8289
log(rtwex) 0.98302 0.40015 2.457 0.0154 *
befile6 0.05957 0.26097 0.228 0.8198
affile6 -0.03241 0.26430 -0.123 0.9026
afdec6 -0.56524 0.28584 -1.978 0.0502 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5974 on 124 degrees of freedom

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 7/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)
Multiple R-squared: 0.3049, Adjusted R-squared: 0.2712
F-statistic: 9.064 on 6 and 124 DF, p-value: 3.255e-08

Agora, criando uma tabela com as várias saídas de modelos, com o pacote stargazer tem-se, com a geração de AIC e BIC:

> library(stargazer)
> mod1$AIC <- AIC(mod1)
>
> mod1$BIC <- BIC(mod1)
>
> library(stargazer)
> star.1 <- stargazer(mod1,
+ title="Título: Resultado da Regressão",
+ align=TRUE,
+ type = "text", style = "all",
+ keep.stat=c("aic","bic","rsq", "adj.rsq","n")
+ )

Título: Resultado da Regressão


===============================================
Dependent variable:
---------------------------
log(chnimp)
-----------------------------------------------
log(chempi) 3.117***
(0.479)
t = 6.505
p = 0.000
log(gas) 0.196
(0.907)
t = 0.217
p = 0.829
log(rtwex) 0.983**
(0.400)
t = 2.457
p = 0.016
befile6 0.060
(0.261)
t = 0.228
p = 0.820
affile6 -0.032
(0.264)
t = -0.123
p = 0.903
afdec6 -0.565*
(0.286)
t = -1.978
p = 0.051
Constant -17.803
(21.045)
t = -0.846
p = 0.400
-----------------------------------------------
Observations 131
R2 0.305
Adjusted R2 0.271
Akaike Inf. Crit. 245.573
Bayesian Inf. Crit. 268.575
===============================================
Note: *p<0.1; **p<0.05; ***p<0.01

2 Autocorrelação dos resíduos


> library(car); library(lmtest);library(sandwich)

Loading required package: carData

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 8/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

> n<-nrow(dados) #armazenando o valor de n=numero de observacoes


> k <- length(coefficients(mod1))-1 #obtendo o numero de regressores menos o intercepto
> c("número de observações: n=",n)

[1] "número de observações: n=" "131"

> c("número de variáveis explicativas k=",k)

[1] "número de variáveis explicativas k="


[2] "6"

> #Exemplo Wooldridge 12.3:


> # Breusch-Godfrey LM Serial Correlation test:
>
> residual <- resid(mod1)
>
> resreg <- dynlm(residual ~ L(residual)+L(residual,2)+L(residual,3)+
+ log(chempi)+log(gas)+log(rtwex)+befile6+
+ affile6+afdec6, data=tsdata )
> summary(resreg)

Time series regression with "ts" data:


Start = 1978(5), End = 1988(12)

Call:
dynlm(formula = residual ~ L(residual) + L(residual, 2) + L(residual,
3) + log(chempi) + log(gas) + log(rtwex) + befile6 + affile6 +
afdec6, data = tsdata)

Residuals:
Min 1Q Median 3Q Max
-1.89072 -0.32250 0.05873 0.36376 1.19650

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -14.36906 20.65566 -0.696 0.4880
L(residual) 0.22149 0.09166 2.417 0.0172 *
L(residual, 2) 0.13404 0.09216 1.454 0.1485
L(residual, 3) 0.12554 0.09112 1.378 0.1709
log(chempi) -0.14316 0.47203 -0.303 0.7622
log(gas) 0.62330 0.88597 0.704 0.4831
log(rtwex) 0.17867 0.39103 0.457 0.6486
befile6 -0.08592 0.25101 -0.342 0.7327
affile6 -0.12212 0.25470 -0.479 0.6325
afdec6 -0.06683 0.27437 -0.244 0.8080
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5704 on 118 degrees of freedom


Multiple R-squared: 0.1159, Adjusted R-squared: 0.04848
F-statistic: 1.719 on 9 and 118 DF, p-value: 0.09202

> linearHypothesis(resreg,
+ c("L(residual)","L(residual, 2)","L(residual, 3)"))

Linear hypothesis test

Hypothesis:
L(residual) = 0
L(residual, 2) = 0
L(residual, 3) = 0

Model 1: restricted model


Model 2: residual ~ L(residual) + L(residual, 2) + L(residual, 3) + log(chempi) +
log(gas) + log(rtwex) + befile6 + affile6 + afdec6

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 9/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

Res.Df RSS Df Sum of Sq F Pr(>F)


1 121 43.394
2 118 38.394 3 5.0005 5.1229 0.00229 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

> r2aux<-summary(resreg)$r.squared
> r2aux

[1] 0.1159108

> nr2<-n*r2aux
> nr2

[1] 15.18431

> bgtest3.chi<-bgtest(mod1,order = 3,type=c("Chisq"), data = tsdata)


> bgtest3.chi # padrao do teste de BG, com distribuição qui-quadrado

Breusch-Godfrey test for serial correlation of order up to 3

data: mod1
LM test = 14.768, df = 3, p-value = 0.002026

> bgtest3.F<-bgtest(mod1,order = 3,type=c("F"), data = tsdata)


> bgtest3.F #alternativa do teste de BG com versão para amostra finita

Breusch-Godfrey test for serial correlation of order up to 3

data: mod1
LM test = 5.1247, df1 = 3, df2 = 121, p-value = 0.002264

> dw.mod1<-dwtest(mod1)
> dw.mod1

Durbin-Watson test

data: mod1
DW = 1.4584, p-value = 0.0001688
alternative hypothesis: true autocorrelation is greater than 0

Fiz uma rotina para rodar vários BGtest até ordem 12.

> # padrao do teste de BG, com distribuição qui-quadrado


> bgorder = 1:12 # definindo até a máxima ordem do bgtest
> d=NULL
> for (p in bgorder) {
+ bgtest.chi<-bgtest(mod1,
+ order = p,type=c("Chisq"), data = tsdata)
+ print(bgtest.chi)
+ d = rbind(d,
+ data.frame(bgtest.chi$statistic,bgtest.chi$p.value))
+ }

Breusch-Godfrey test for serial correlation of order up to 1

data: mod1
LM test = 9.8291, df = 1, p-value = 0.001718

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 10/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

Breusch-Godfrey test for serial correlation of order up to 2

data: mod1
LM test = 12.935, df = 2, p-value = 0.001553

Breusch-Godfrey test for serial correlation of order up to 3

data: mod1
LM test = 14.768, df = 3, p-value = 0.002026

Breusch-Godfrey test for serial correlation of order up to 4

data: mod1
LM test = 17.463, df = 4, p-value = 0.001571

Breusch-Godfrey test for serial correlation of order up to 5

data: mod1
LM test = 17.465, df = 5, p-value = 0.003697

Breusch-Godfrey test for serial correlation of order up to 6

data: mod1
LM test = 17.555, df = 6, p-value = 0.007445

Breusch-Godfrey test for serial correlation of order up to 7

data: mod1
LM test = 18.881, df = 7, p-value = 0.008569

Breusch-Godfrey test for serial correlation of order up to 8

data: mod1
LM test = 18.9, df = 8, p-value = 0.0154

Breusch-Godfrey test for serial correlation of order up to 9

data: mod1
LM test = 22.435, df = 9, p-value = 0.007598

Breusch-Godfrey test for serial correlation of order up to 10

data: mod1
LM test = 22.438, df = 10, p-value = 0.01302

Breusch-Godfrey test for serial correlation of order up to 11

data: mod1
LM test = 23.335, df = 11, p-value = 0.01585

Breusch-Godfrey test for serial correlation of order up to 12

data: mod1
LM test = 23.935, df = 12, p-value = 0.02076

> d

bgtest.chi.statistic bgtest.chi.p.value
LM test 9.829115 0.001717710
LM test1 12.934847 0.001553223

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 11/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)
LM test2 14.768156 0.002025887
LM test3 17.463024 0.001570843
LM test4 17.465245 0.003696957
LM test5 17.555240 0.007445324
LM test6 18.880776 0.008569139
LM test7 18.900273 0.015402181
LM test8 22.434946 0.007598117
LM test9 22.437807 0.013023155
LM test10 23.334705 0.015849005
LM test11 23.935057 0.020758676

A solução passa por alternativas na modelagem de AR e MA ou procedimentos de Cochrane-Orcutt.

2.1 Cochrane-Orcutt MQG Factível


> library(orcutt)
>
> # OLS estimation
>
> olsres <- dynlm(log(chnimp)~log(chempi)+log(gas)+log(rtwex)+ befile6+affile
6+afdec6, data=tsdata)
>
> # Cochrane-Orcutt estimation
> cochrane.orcutt(olsres)

Cochrane-orcutt estimation for first order autocorrelation

Call:
dynlm(formula = log(chnimp) ~ log(chempi) + log(gas) + log(rtwex) +
befile6 + affile6 + afdec6, data = tsdata)

number of interaction: 8
rho 0.293362

Durbin-Watson statistic
(original): 1.45841 , p-value: 1.688e-04
(transformed): 2.06330 , p-value: 4.91e-01

coefficients:
(Intercept) log(chempi) log(gas) log(rtwex) befile6 affile6
-37.322241 2.947434 1.054858 1.136918 -0.016372 -0.033082
afdec6
-0.577158

2.2 Prais-Winsten MQG Factível


Carregar o pacote prais e usar a função prais_winsten para estimar.

> library(prais)
> barium_prais_winsten <- prais_winsten(log(chnimp)~log(chempi)+log(gas)+log(rtwex)+
+ befile6+affile6+afdec6, data=tsdata)

Iteration 0: rho = 0
Iteration 1: rho = 0.2708
Iteration 2: rho = 0.291
Iteration 3: rho = 0.293
Iteration 4: rho = 0.2932
Iteration 5: rho = 0.2932
Iteration 6: rho = 0.2932
Iteration 7: rho = 0.2932

> summary(barium_prais_winsten)

Call:
prais_winsten(formula = log(chnimp) ~ log(chempi) + log(gas) +
log(rtwex) + befile6 + affile6 + afdec6, data = tsdata)

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 12/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

Residuals:
Min 1Q Median 3Q Max
-1.99386 -0.32219 0.03747 0.40226 1.50281

AR(1) Coefficient rho after 7 Iterations: 0.2932

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -37.07742 22.77831 -1.628 0.1061
log(chempi) 2.94095 0.63284 4.647 8.46e-06 ***
log(gas) 1.04637 0.97734 1.071 0.2864
log(rtwex) 1.13279 0.50666 2.236 0.0272 *
befile6 -0.01648 0.31938 -0.052 0.9589
affile6 -0.03316 0.32181 -0.103 0.9181
afdec6 -0.57681 0.34199 -1.687 0.0942 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5733 on 124 degrees of freedom


Multiple R-squared: 0.2021, Adjusted R-squared: 0.1635
F-statistic: 5.235 on 6 and 124 DF, p-value: 7.764e-05

Durbin-Watson statistic (original): 1.458


Durbin-Watson statistic (transformed): 2.087

2.3 Inferência Robusta - Newey-West


Conforme a ordem da autocorelação, pode ser mais indicado considerar o tratamento para a estrutura geral de Newey e West (1987) e
Wooldridge (1989), citados por Wooldridge (2016, seção 12.5).

> # library(sandwich)
> # OLS regression
> # foi feita a mod1
> mod1 <- dynlm(log(chnimp)~log(chempi)+log(gas)+log(rtwex)+
+ befile6+affile6+afdec6, data=tsdata )
> # resultados com erros-padrões usuais
> coeftest(mod1)

t test of coefficients:

Estimate Std. Error t value Pr(>|t|)


(Intercept) -17.802768 21.045367 -0.8459 0.39922
log(chempi) 3.117194 0.479202 6.5050 1.724e-09 ***
log(gas) 0.196341 0.906617 0.2166 0.82890
log(rtwex) 0.983016 0.400154 2.4566 0.01541 *
befile6 0.059574 0.260970 0.2283 0.81980
affile6 -0.032406 0.264297 -0.1226 0.90261
afdec6 -0.565245 0.285835 -1.9775 0.05020 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

> # resultados com Erros-padrões HAC - robusto a heterocedasticidade e autocorrelação


> coeftest(mod1, vcovHAC)

t test of coefficients:

Estimate Std. Error t value Pr(>|t|)


(Intercept) -17.802768 26.497047 -0.6719 0.50291
log(chempi) 3.117194 0.654191 4.7650 5.188e-06 ***
log(gas) 0.196341 1.196616 0.1641 0.86994
log(rtwex) 0.983016 0.450206 2.1835 0.03088 *
befile6 0.059574 0.153259 0.3887 0.69815
affile6 -0.032406 0.233788 -0.1386 0.88998
afdec6 -0.565245 0.249559 -2.2650 0.02525 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 13/14
07/01/2019 RPubs - Econometria: exemplos Bário 10.5 e 12.3 do Wooldridge (2016, p.390)

> summary(mod1,vcov. = vcovHAC)

Time series regression with "ts" data:


Start = 1978(2), End = 1988(12)

Call:
dynlm(formula = log(chnimp) ~ log(chempi) + log(gas) + log(rtwex) +
befile6 + affile6 + afdec6, data = tsdata)

Residuals:
Min 1Q Median 3Q Max
-2.03356 -0.39080 0.03048 0.40248 1.51720

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -17.80277 26.49705 -0.672 0.5029
log(chempi) 3.11719 0.65419 4.765 5.19e-06 ***
log(gas) 0.19634 1.19662 0.164 0.8699
log(rtwex) 0.98302 0.45021 2.183 0.0309 *
befile6 0.05957 0.15326 0.389 0.6982
affile6 -0.03241 0.23379 -0.139 0.8900
afdec6 -0.56524 0.24956 -2.265 0.0253 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5974 on 124 degrees of freedom


Multiple R-squared: 0.3049, Adjusted R-squared: 0.2712
F-statistic: 5.8 on 6 and 124 DF, p-value: 2.366e-05

http://rpubs.com/amrofi/ex_wooldridge_12_3_autocorrelation 14/14

S-ar putea să vă placă și