Chapter 12: Serial Correlation and Heteroskedasticity in Time Series Regressions

library("lmtest")
library("prais")
library("sandwich")
library("tseries")
library("wooldridge")

Example 12.1

data("phillips")

Static Phillips curve

model_12_1_1 <- lm(inf ~ unem, data = phillips)

res_static <- model_12_1_1[["residuals"]]
res_static_1 <- c(NA, model_12_1_1[["residuals"]][-(length(res_static))])

model_12_1_1_test <- lm(res_static ~ res_static_1)
summary(model_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

model_12_1_2 <- lm(I(inf - inf_1) ~ unem, data = phillips)

res_aug <- model_12_1_2[["residuals"]]
res_aug_1 <- c(NA, model_12_1_2[["residuals"]][-length(res_aug)])

model_12_1_2_test <- lm(res_aug ~ res_aug_1)
summary(model_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(model_12_1_1_test,
         vcov = vcovHC(model_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(model_12_1_2_test,
         vcov = vcovHC(model_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")

model_12_2 <- lm(lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)

res_12_2 <- model_12_2[["residuals"]]
res_12_2_1 <- c(NA, model_12_2[["residuals"]][-length(res_12_2)])

model_12_2_test <- lm(res_12_2 ~ lmincov + lusgnp + lprgnp + t + res_12_2_1,
                      data = prminwge)
summary(model_12_2_test)
## 
## Call:
## lm(formula = res_12_2 ~ lmincov + lusgnp + lprgnp + t + res_12_2_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   
## res_12_2_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(res_12_2 ~ res_12_2_1))
## 
## Call:
## lm(formula = res_12_2 ~ res_12_2_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  
## res_12_2_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")

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

res_12_3 <- model_12_3[["residuals"]]
n_res <- length(res_12_3)
res_12_3_1 <- c(NA, model_12_3[["residuals"]][1:(n_res - 1)])
res_12_3_2 <- c(NA, NA, model_12_3[["residuals"]][1:(n_res - 2)])
res_12_3_3 <- c(NA, NA, NA, model_12_3[["residuals"]][1:(n_res - 3)])

barium_res <- cbind(barium, res_12_3)
barium_res <- cbind(barium_res, res_12_3_1)
barium_res <- cbind(barium_res, res_12_3_2)
barium_res <- cbind(barium_res, res_12_3_3)

model_12_3_test <- lm(res_12_3 ~ lchempi + lgas + lrtwex + befile6 + affile6 +
                        afdec6 + res_12_3_1 + res_12_3_2 + res_12_3_3,
                      data = barium_res)

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

anova(model_12_3_test, model_12_3_test_res)
## Analysis of Variance Table
## 
## Model 1: res_12_3 ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6 + 
##     res_12_3_1 + res_12_3_2 + res_12_3_3
## Model 2: res_12_3 ~ 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

res_12_3_12 <- c(rep(NA, 12), model_12_3[["residuals"]][1:(n_res - 12)])
barium_res <- cbind(barium_res, res_12_3_12)

summary(lm(res_12_3 ~ res_12_3_12, data = barium_res))
## 
## Call:
## lm(formula = res_12_3 ~ res_12_3_12, data = barium_res)
## 
## 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  
## res_12_3_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(res_12_3 ~ lchempi + lgas + lrtwex + befile6 + affile6 + afdec6 +
             res_12_3_12,
           data = barium_res))
## 
## Call:
## lm(formula = res_12_3 ~ lchempi + lgas + lrtwex + befile6 + affile6 + 
##     afdec6 + res_12_3_12, data = barium_res)
## 
## 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  
## res_12_3_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")

pw_1 <- prais_winsten(lchnimp ~ lchempi + lgas + lrtwex + befile6 + affile6 +
                        afdec6,
                      data = barium,
                      index = "t")
## 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, index = "t")
## 
## Residuals of the transformed model:
##      Min       1Q   Median       3Q      Max 
## -2.01146 -0.39152  0.06758  0.35063  1.35021 
## 
## 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

model_12_5 <- lm(inf ~ unem, data = phillips)
summary(model_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, index = "year")
## 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, index = "year")
## 
## Residuals of the transformed model:
##     Min      1Q  Median      3Q     Max 
## -7.2057 -0.9265 -0.2019  0.9384  5.6591 
## 
## 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")

model_12_6_1 <- lm(i3 ~ inf + def, data = intdef)
summary(model_12_6_1)
## 
## 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 <- model_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
model_12_6_2 <- lm(I(diff(i3)) ~ I(diff(inf)) + I(diff(def)), data = intdef)
summary(model_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}\)

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

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

res <- model_12_6_2[["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.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")

model_12_7_1 <- lm(lprepop ~ lmincov + lusgnp + lprgnp + t, data = prminwge)
summary(model_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/heteroskedasticity robust se.

pw_12_7_1 <- prais_winsten(lprepop ~ lmincov + lusgnp + lprgnp + t,
                           data = prminwge,
                           index = "t")
## 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, index = "t")
## 
## Residuals of the transformed model:
##       Min        1Q    Median        3Q       Max 
## -0.056867 -0.017884 -0.003432  0.011239  0.062688 
## 
## 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")

model_12_8 <- lm(return ~ return_1, data = nyse)
summary(model_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 <- model_12_8[["residuals"]]^2

model_12_8_bp <- lm(res ~ return_1, data = na.omit(nyse))
summary(model_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")

model_12_9 <- lm(return ~ return_1, data = nyse)
summary(model_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 <- model_12_8[["residuals"]]
u_1 <- c(NA, u[-length(u)])
usq <- model_12_8[["residuals"]]^2
usq_1 <- c(NA, usq[-length(usq)])

model_12_9_arch <- lm(usq ~ usq_1)
summary(model_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
model_12_9_3 <- lm(u ~ u_1)
summary(model_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

I hope this article was helpful. If you like, feel free to

support me with a coffee