Assignment 3 - Applied Linear Regression
1) Application of heteroskedasticity tests on MINITAB:
a) Compute the test of White and explain your statistical decision.
b) Compute the Goldfeld - Quandt test and explain whether or not you reject the null hypothesis. (choose number of points to remove, c = 4)
2) Application of autocorrelation tests on MINITAB:
a) Compute Durbin Watson test and the LM test for autocorrelation.
b) Apply Cochrane-Orcutt procedure (only 2 iterations) to estimate the Model.
c) Compute again the Durbin Watson test for the transformed model. Was the autocorrelation issue resolved?
Helpful links:
[1] http://www.michaeljgrogan.com/serial-correlation-and-the-cochrane-orcutt-remedy/
[2] https://www.youtube.com/watch?v=6kXcCfdwSKI
<img src="images/giphy.gif” alt="hi" class="inline"/>
Above: Before and after Cochrane-Orcutt remedy. LS fit (left), residuals (right)
HOMOSCEDASTICITY
Fitting the model:
> lmtest::bptest(model1, studentize=TRUE)
Call:
lm(formula = y ~ x, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.78843 -1.44242 0.04263 1.32336 2.53848
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -19.04257 1.02536 -18.57 3.85e-16 ***
x 0.39013 0.01196 32.63 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.713 on 25 degrees of freedom
Multiple R-squared: 0.9771, Adjusted R-squared: 0.9761
F-statistic: 1065 on 1 and 25 DF, p-value: < 2.2e-16
Test of White is type of B-P Test:
studentized Breusch-Pagan test
data: model1
BP = 7.7221, df = 1, p-value = 0.005455
Goldfeld-Quandt test
> lmtest::gqtest(formula = y ~ x, fraction = 4, data = data)
Goldfeld-Quandt test
data: y ~ x
GQ = 5.7356, df1 = 10, df2 = 9, p-value = 0.007417
alternative hypothesis: variance increases from segment 1 to 2
AUTOCORRELATION
Durbin-Watson Test
> lmtest::dwtest(formula = model1, data = data)
Durbin-Watson test
data: model1
DW = 0.33192, p-value = 6.346e-10
alternative hypothesis: true autocorrelation is greater than 0
Cochrane-Orcutt
> coch = cochrane.orcutt( lm(y~x,data=data))
> summary(coch)
Call:
lm(formula = y ~ x, data = data)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -19.031124 2.688410 -7.079 2.562e-07 ***
x 0.385092 0.025953 14.838 1.375e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9323 on 24 degrees of freedom
Multiple R-squared: 0.9017 , Adjusted R-squared: 0.8976
F-statistic: 220.2 on 1 and 24 DF, p-value: < 1.375e-13
Durbin-Watson statistic
(original): 0.33192 , p-value: 6.346e-10 < 0.05
(transformed): 1.76582 , p-value: 2.078e-01 -> 0.2078 > 0.05