Linear regression

Let's get started with the spurious regression then, which I have seen implemented in the real world far too often. Here we simply build a linear model and examine the results:

    > fit.lm <- lm(Temp ~ CO2, data = climate)

> summary(fit.lm)

Call:
lm(formula = Temp ~ CO2, data = climate)

Residuals:
Min 1Q Median 3Q Max
-0.36411 -0.08986 0.00011 0.09475 0.28763

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.430e-01 2.357e-02 -10.31 <2e-16 ***
CO2 7.548e-05 5.047e-06 14.96 <2e-16 ***
---
Signif. codes:
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1299 on 93 degrees of freedom
Multiple R-squared: 0.7063, Adjusted R-squared: 0.7032
F-statistic: 223.7 on 1 and 93 DF, p-value: < 2.2e-16

Notice how everything is significant, and we have an adjusted R-squared of 0.7. OK, they are highly correlated but this is all meaningless as discussed by Granger and Newbold (1974). Again, I have seen results like these presented in meetings with many people with advanced degrees, and I had to be the bad guy and challenge the results.

We can plot the serial correlation, starting with a time series plot of the residuals, which produce a clear pattern:

    > plot.ts(fit.lm$residuals)

The output of the preceding code is as follows: 

Then we create an ACF plot showing significant autocorrelation out to lag 10:

    > acf(fit.lm$residuals)

You can test for autocorrelation by performing the Durbin-Watson test. The null hypothesis in the test is no autocorrelation exists:

    > dwtest(fit.lm)

Durbin-Watson test

data: fit.lm
DW = 0.77425, p-value = 4.468e-12
alternative hypothesis: true autocorrelation is greater than 0

From examining the plots, it comes as no surprise that we can safely reject the null hypothesis of no autocorrelation. The simple way to deal with autocorrelation is to incorporate lagged variables of the dependent time series and/or to make all the data stationary. We will do that next using vector autoregression to identify the appropriate lag structure to incorporate in our causality efforts. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset