Chapter12: Serial Correlation and Heteroskedasticity in Time Series Regressions

library(lmtest)
library(sandwich)
library(tseries)
library(wooldridge)

Example 12.1

data("phillips")

Static Phillips curve

lm.12.1.1 <- lm(inf ~ unem, data = phillips)
res.static <- lm.12.1.1$res
res.static_1 <- c(NA, lm.12.1.1$res[-(length(res.static))])
lm.12.1.1.test <- lm(res.static ~ res.static_1)
summary(lm.12.1.1.test)
## 
## Call:
## lm(formula = res.static ~ res.static_1)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -8.047 -1.104 -0.248  1.028  6.684 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -0.1118     0.3180  -0.352    0.727    
## res.static_1   0.5725     0.1084   5.283 2.43e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.358 on 53 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.345,  Adjusted R-squared:  0.3326 
## F-statistic: 27.91 on 1 and 53 DF,  p-value: 2.43e-06

Augmented Phillips curve

lm.12.1.2 <- lm(I(inf - inf_1) ~ unem, data = phillips)
res.aug <- lm.12.1.2$res
res.aug_1 <- c(NA, lm.12.1.2$res[-length(res.aug)])
lm.12.1.2.test <- lm(res.aug ~ res.aug_1)
summary(lm.12.1.2.test)
## 
## Call:
## lm(formula = res.aug ~ res.aug_1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -7.2635 -1.0828 -0.1021  0.7254  5.3916 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)   0.1674     0.2655   0.631    0.531
## res.aug_1    -0.0327     0.1164  -0.281    0.780
## 
## Residual standard error: 1.951 on 52 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.001516,   Adjusted R-squared:  -0.01769 
## F-statistic: 0.07896 on 1 and 52 DF,  p-value: 0.7798

Heteroskedasticity robust t statistic

coeftest(lm.12.1.1.test, vcov = vcovHC(lm.12.1.1.test, type = "HC0"))
## 
## t test of coefficients:
## 
##              Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)  -0.11181    0.30962 -0.3611 0.7194474    
## res.static_1  0.57247    0.14225  4.0243 0.0001826 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(lm.12.1.2.test, vcov = vcovHC(lm.12.1.2.test, type = "HC0"))
## 
## t test of coefficients:
## 
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.167446   0.262215  0.6386   0.5259
## res.aug_1   -0.032697   0.193249 -0.1692   0.8663

Durbin-Watson Test

# from package lmtest
dwtest(inf ~ unem, data = phillips)
## 
##  Durbin-Watson test
## 
## data:  inf ~ unem
## DW = 0.80148, p-value = 1.486e-07
## alternative hypothesis: true autocorrelation is greater than 0
dwtest(I(inf - inf_1) ~ unem, data = phillips)
## 
##  Durbin-Watson test
## 
## data:  I(inf - inf_1) ~ unem
## DW = 1.771, p-value = 0.1673
## alternative hypothesis: true autocorrelation is greater than 0

Example 12.2

data("prminwge")

lm.12.2 <- lm(lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)
lm.12.2.res <- lm.12.2$res
lm.12.2.res_1 <- c(NA, lm.12.2$res[-length(lm.12.2.res)])
lm.12.2.test <- lm(lm.12.2.res ~ lmincov + lusgnp + lprgnp + t + lm.12.2.res_1, data = prminwge)
summary(lm.12.2.test)
## 
## Call:
## lm(formula = lm.12.2.res ~ lmincov + lusgnp + lprgnp + t + lm.12.2.res_1, 
##     data = prminwge)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.041317 -0.018004 -0.004599  0.012378  0.067226 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)   
## (Intercept)   -0.850772   1.092691  -0.779  0.44212   
## lmincov        0.037500   0.035212   1.065  0.29511   
## lusgnp         0.203932   0.195159   1.045  0.30412   
## lprgnp        -0.078466   0.070524  -1.113  0.27443   
## t             -0.003466   0.004074  -0.851  0.40134   
## lm.12.2.res_1  0.480509   0.166444   2.887  0.00703 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02755 on 31 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.2424, Adjusted R-squared:  0.1202 
## F-statistic: 1.983 on 5 and 31 DF,  p-value: 0.1089

For comparison the test with strict exogenous regressors

summary(lm(lm.12.2.res ~ lm.12.2.res_1))
## 
## Call:
## lm(formula = lm.12.2.res ~ lm.12.2.res_1)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.043815 -0.024235 -0.002278  0.015155  0.063480 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   -0.0008953  0.0044883  -0.199   0.8431  
## lm.12.2.res_1  0.4173219  0.1589351   2.626   0.0127 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02723 on 35 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.1646, Adjusted R-squared:  0.1407 
## F-statistic: 6.895 on 1 and 35 DF,  p-value: 0.01274

Example 12.3

data("barium")

lm.12.3 <- lm(lchnimp ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6, data = barium)

lm.12.3.res <- lm.12.3$res
lm.12.3.res_1 <- c(NA,lm.12.3$res[1:(length(lm.12.3.res)-1)])
lm.12.3.res_2 <- c(NA,NA,lm.12.3$res[1:(length(lm.12.3.res)-2)])
lm.12.3.res_3 <- c(NA,NA,NA,lm.12.3$res[1:(length(lm.12.3.res)-3)])

data <- cbind(barium, lm.12.3.res)
data <- cbind(data, lm.12.3.res_1)
data <- cbind(data, lm.12.3.res_2)
data <- cbind(data, lm.12.3.res_3)

lm.12.3.test <- lm(lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6 +
 lm.12.3.res_1 + lm.12.3.res_2 + lm.12.3.res_3, data = data)

lm.12.3.test.res <- lm(lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6,
 data = data[-(1:3),]) # Drop first 3 observations to make test statistics comparable

anova(lm.12.3.test, lm.12.3.test.res)
## Analysis of Variance Table
## 
## Model 1: lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6 + 
##     lm.12.3.res_1 + lm.12.3.res_2 + lm.12.3.res_3
## Model 2: lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6
##   Res.Df    RSS Df Sum of Sq      F  Pr(>F)   
## 1    118 38.394                               
## 2    121 43.394 -3   -5.0005 5.1229 0.00229 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Seasonal autocorrelation

data <- cbind(data, lm.12.3.res_12 = c(rep(NA, 12), lm.12.3$res[1:(length(lm.12.3.res) - 12)]))
summary(lm(lm.12.3.res ~ lm.12.3.res_12, data = data))
## 
## Call:
## lm(formula = lm.12.3.res ~ lm.12.3.res_12, data = data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.96217 -0.33069  0.03732  0.36389  1.46367 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)  
## (Intercept)     0.03789    0.05047   0.751    0.454  
## lm.12.3.res_12 -0.18744    0.08425  -2.225    0.028 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5506 on 117 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.04059,    Adjusted R-squared:  0.03239 
## F-statistic:  4.95 on 1 and 117 DF,  p-value: 0.02801

Include regressors

summary(lm(lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6 +
 lm.12.3.res_12, data = data))
## 
## Call:
## lm(formula = lm.12.3.res ~ lchempi + lgas + lrtwex + befile6 + 
##     affile6 + afdec6 + lm.12.3.res_12, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.0259 -0.3467  0.0158  0.3770  1.3676 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)  
## (Intercept)    -28.57195   22.64780  -1.262   0.2097  
## lchempi         -0.92803    0.54647  -1.698   0.0923 .
## lgas             1.50251    1.01497   1.480   0.1416  
## lrtwex          -0.27439    0.38127  -0.720   0.4732  
## befile6          0.04437    0.24581   0.180   0.8571  
## affile6          0.06253    0.24600   0.254   0.7998  
## afdec6           0.17231    0.27038   0.637   0.5253  
## lm.12.3.res_12  -0.17002    0.08670  -1.961   0.0524 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5541 on 111 degrees of freedom
##   (12 observations deleted due to missingness)
## Multiple R-squared:  0.07811,    Adjusted R-squared:  0.01997 
## F-statistic: 1.344 on 7 and 111 DF,  p-value: 0.2367

Example 12.4

data("barium")

# Download my prais package
library(prais)

pw_1 <- prais_winsten(lchnimp ~ lchempi + lgas + lrtwex + befile6 + 
 affile6 + afdec6, data = barium)
## 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(pw_1)
## 
## Call:
## prais_winsten(formula = lchnimp ~ lchempi + lgas + lrtwex + befile6 + 
##     affile6 + afdec6, data = barium)
## 
## 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.07770   22.77830  -1.628   0.1061    
## lchempi       2.94095    0.63284   4.647 8.46e-06 ***
## lgas          1.04638    0.97734   1.071   0.2864    
## lrtwex        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

Example 12.5

data("phillips")

First column

lm.12.5 <- lm(inf ~ unem, data = phillips)
summary(lm.12.5)
## 
## Call:
## lm(formula = inf ~ unem, data = phillips)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.2176 -1.7812 -0.6659  1.1473  8.8795 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)   1.0536     1.5480   0.681   0.4990  
## unem          0.5024     0.2656   1.892   0.0639 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.972 on 54 degrees of freedom
## Multiple R-squared:  0.06215,    Adjusted R-squared:  0.04479 
## F-statistic: 3.579 on 1 and 54 DF,  p-value: 0.06389

Second column

pw_2 <- prais_winsten(inf ~ unem, data=phillips)
## Iteration 0: rho = 0
## Iteration 1: rho = 0.5721
## Iteration 2: rho = 0.735
## Iteration 3: rho = 0.7792
## Iteration 4: rho = 0.7871
## Iteration 5: rho = 0.7883
## Iteration 6: rho = 0.7885
## Iteration 7: rho = 0.7885
## Iteration 8: rho = 0.7885
## Iteration 9: rho = 0.7885
summary(pw_2)
## 
## Call:
## prais_winsten(formula = inf ~ unem, data = phillips)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -5.258 -2.447 -1.073  1.463 10.570 
## 
## AR(1) coefficient rho after 9 Iterations: 0.7885
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   7.9994     2.0483   3.905 0.000264 ***
## unem         -0.7140     0.2898  -2.464 0.016965 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.138 on 54 degrees of freedom
## Multiple R-squared:  0.1345, Adjusted R-squared:  0.1185 
## F-statistic: 8.393 on 1 and 54 DF,  p-value: 0.00543
## 
## Durbin-Watson statistic (original): 0.8015 
## Durbin-Watson statistic (transformed): 1.914

Example 12.6

data("intdef")

summary(lm.12.6.1 <- lm(i3 ~ inf + def, data = intdef))
## 
## Call:
## lm(formula = i3 ~ inf + def, data = intdef)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.9948 -1.1694  0.1959  0.9602  4.7224 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.73327    0.43197   4.012  0.00019 ***
## inf          0.60587    0.08213   7.376 1.12e-09 ***
## def          0.51306    0.11838   4.334 6.57e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.843 on 53 degrees of freedom
## Multiple R-squared:  0.6021, Adjusted R-squared:  0.5871 
## F-statistic: 40.09 on 2 and 53 DF,  p-value: 2.483e-11
res <- lm.12.6.1$residuals
res_1 <- c(NA, res[-length(res)])
summary(lm(res ~ -1 + res_1))
## 
## Call:
## lm(formula = res ~ -1 + res_1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.8010 -0.6616  0.0179  0.8721  4.5901 
## 
## Coefficients:
##       Estimate Std. Error t value Pr(>|t|)    
## res_1   0.6229     0.1087    5.73 4.61e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.397 on 54 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.3781, Adjusted R-squared:  0.3666 
## F-statistic: 32.83 on 1 and 54 DF,  p-value: 4.612e-07
lm.12.6.2 <- lm(I(diff(i3)) ~ I(diff(inf)) + I(diff(def)), data = intdef)
summary(lm.12.6.2)
## 
## Call:
## lm(formula = I(diff(i3)) ~ I(diff(inf)) + I(diff(def)), data = intdef)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.53316 -0.96248 -0.08658  0.75884  2.93846 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept)   0.04177    0.17139   0.244    0.808
## I(diff(inf))  0.14949    0.09216   1.622    0.111
## I(diff(def)) -0.18132    0.14768  -1.228    0.225
## 
## Residual standard error: 1.265 on 52 degrees of freedom
## Multiple R-squared:  0.1763, Adjusted R-squared:  0.1446 
## F-statistic: 5.566 on 2 and 52 DF,  p-value: 0.006451

Correlation between \(i3_t\) and \(i3_{t-1}\)

cor(intdef$i3, c(NA, intdef$i3[-length(intdef$i3)]), use = "pairwise.complete.obs")
## [1] 0.8845033

Regression of \(e_t\) on \(e_{t-1}\)

res <- lm.12.6.2$residuals
res_1 <- res_1 <- c(NA, res[-length(res)])
summary(lm(res ~ -1 + res_1))
## 
## Call:
## lm(formula = res ~ -1 + res_1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.7439 -0.9833 -0.1421  0.7773  2.8453 
## 
## Coefficients:
##       Estimate Std. Error t value Pr(>|t|)
## res_1  0.07172    0.13305   0.539    0.592
## 
## Residual standard error: 1.212 on 53 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.005454,   Adjusted R-squared:  -0.01331 
## F-statistic: 0.2906 on 1 and 53 DF,  p-value: 0.5921

Example 12.7

data("prminwge")

lm.12.7.1 <- lm(lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)
summary(lm.12.7.1)
## 
## Call:
## lm(formula = lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.054679 -0.023653 -0.004039  0.018638  0.076947 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -6.663432   1.257831  -5.298 7.67e-06 ***
## lmincov     -0.212261   0.040152  -5.286 7.92e-06 ***
## lusgnp       0.486046   0.221983   2.190   0.0357 *  
## lprgnp       0.285239   0.080492   3.544   0.0012 ** 
## t           -0.026663   0.004627  -5.763 1.94e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03277 on 33 degrees of freedom
## Multiple R-squared:  0.8892, Adjusted R-squared:  0.8758 
## F-statistic: 66.23 on 4 and 33 DF,  p-value: 2.677e-15

Still looking for the SC/heteroskedasticiy robust se.

pw_12_7_1 <- prais_winsten(lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)
## Iteration 0: rho = 0
## Iteration 1: rho = 0.4197
## Iteration 2: rho = 0.5325
## Iteration 3: rho = 0.5796
## Iteration 4: rho = 0.5999
## Iteration 5: rho = 0.6086
## Iteration 6: rho = 0.6123
## Iteration 7: rho = 0.6139
## Iteration 8: rho = 0.6146
## Iteration 9: rho = 0.6149
## Iteration 10: rho = 0.615
## Iteration 11: rho = 0.6151
## Iteration 12: rho = 0.6151
## Iteration 13: rho = 0.6151
## Iteration 14: rho = 0.6151
## Iteration 15: rho = 0.6151
## Iteration 16: rho = 0.6151
summary(pw_12_7_1)
## 
## Call:
## prais_winsten(formula = lprepop ~ lmincov + lusgnp + lprgnp + 
##     t, data = prminwge)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.079574 -0.028121 -0.004816  0.005918  0.075978 
## 
## AR(1) coefficient rho after 16 Iterations: 0.6151
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept) -4.652853   1.376470  -3.380  0.00188 **
## lmincov     -0.147711   0.045842  -3.222  0.00286 **
## lusgnp       0.255711   0.231750   1.103  0.27784   
## lprgnp       0.251383   0.116462   2.158  0.03826 * 
## t           -0.020502   0.005856  -3.501  0.00135 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02852 on 33 degrees of freedom
## Multiple R-squared:  0.7509, Adjusted R-squared:  0.7207 
## F-statistic: 24.87 on 4 and 33 DF,  p-value: 1.47e-09
## 
## Durbin-Watson statistic (original): 1.014 
## Durbin-Watson statistic (transformed): 1.736

Example 12.8

data("nyse")

lm.12.8 <- lm(return ~ return_1, data = nyse)
summary(lm.12.8)
## 
## Call:
## lm(formula = return ~ return_1, data = nyse)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.261  -1.302   0.098   1.316   8.065 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  0.17963    0.08074   2.225   0.0264 *
## return_1     0.05890    0.03802   1.549   0.1218  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.11 on 687 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.003481,   Adjusted R-squared:  0.00203 
## F-statistic: 2.399 on 1 and 687 DF,  p-value: 0.1218
res <- lm.12.8$residuals^2

lm.12.8.bp <- lm(res ~ return_1, data = na.omit(nyse))
summary(lm.12.8.bp)
## 
## Call:
## lm(formula = res ~ return_1, data = na.omit(nyse))
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
##  -9.689  -3.929  -2.021   0.960 223.730 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   4.6565     0.4277  10.888  < 2e-16 ***
## return_1     -1.1041     0.2014  -5.482  5.9e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11.18 on 687 degrees of freedom
## Multiple R-squared:  0.04191,    Adjusted R-squared:  0.04052 
## F-statistic: 30.05 on 1 and 687 DF,  p-value: 5.905e-08

Example 12.9

data("nyse")

lm.12.9 <- lm(return ~ return_1, data = nyse)
summary(lm.12.9)
## 
## Call:
## lm(formula = return ~ return_1, data = nyse)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.261  -1.302   0.098   1.316   8.065 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  0.17963    0.08074   2.225   0.0264 *
## return_1     0.05890    0.03802   1.549   0.1218  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.11 on 687 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.003481,   Adjusted R-squared:  0.00203 
## F-statistic: 2.399 on 1 and 687 DF,  p-value: 0.1218
u <- lm.12.8$residuals
u_1 <- c(NA, u[-length(u)])
usq <- lm.12.8$residuals^2
usq_1 <- c(NA, usq[-length(usq)])

lm.12.9.arch <- lm(usq ~ usq_1)
summary(lm.12.9.arch)
## 
## Call:
## lm(formula = usq ~ usq_1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -23.337  -3.292  -2.157   0.556 223.981 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.94743    0.44023   6.695 4.49e-11 ***
## usq_1        0.33706    0.03595   9.377  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.76 on 686 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.1136, Adjusted R-squared:  0.1123 
## F-statistic: 87.92 on 1 and 686 DF,  p-value: < 2.2e-16
lm.12.9.3 <- lm(u ~ u_1)
summary(lm.12.9.3)
## 
## Call:
## lm(formula = u ~ u_1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -15.2538  -1.3024   0.0912   1.3217   8.0613 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.001171   0.080508  -0.015    0.988
## u_1          0.001405   0.038177   0.037    0.971
## 
## Residual standard error: 2.112 on 686 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  1.974e-06,  Adjusted R-squared:  -0.001456 
## F-statistic: 0.001354 on 1 and 686 DF,  p-value: 0.9707