I'm working on an econometrics project for which I'm trying to study the impact of factors such as p.c. GDP growth, exports, inflation and interest rate on the debt-to-GDP ratio of a country, for 4 countries over a period of 20 years. I am using an LSDV model for this. And I have run into the problem of autocorrelation. I tried to correct for it using the method of subtracting p times the lagged variables for every observation, but even after this, after plotting the residual against its lag, I still see autocorrelation. How do I fix this?

I've heard that a crucial problem for autocorrelation is not including an independent variable. Till now I was not including the 'year' as a variable in my regression. Would that help? Also, is there any way I could deseasonalize the data or something similar? Please help as I'm not sure how to correct this.

I've heard of a Newey-West or something function in R that gives AC corrected errors? But I feel like our teacher wouldn't appreciate if I just did that without actually correctly the problem? I'd be grateful for any help. Thank you!!


2 Answers 2

  1. Including time as independent variable would correct for deterministic time trend but that would most likely not affect autocorrelation.
  2. Usually the best way how to solve autocorrelation is to explicitly model dynamics by including lagged variables as independent regressors. You can try doing that.
  3. Using Newey-west errors is valid way of correcting for autocorrelation (unless you have model with lagged dependent variable). There is nothing incorrect about using non-standard errors as long as there are no other issues that might affect this. As to whether your teacher would appreciate to use it or not you have to ask him/her.
  • $\begingroup$ Thanks so much for the answer. About your second point, do i include lagged variables of the independent variables or of the dependent variable? Or both? $\endgroup$ Nov 7, 2022 at 16:13
  • $\begingroup$ @viktornikiforov depends on what you believe the dynamic structure of the model is. You can do either of those or both $\endgroup$
    – 1muflon1
    Nov 7, 2022 at 16:36
  • $\begingroup$ sorry exactly what do you mean by the dynamic structure of a model? :'(( $\endgroup$ Nov 7, 2022 at 16:49
  • $\begingroup$ @viktornikiforov how the lag structure of the true model which you want to estimate looks like $\endgroup$
    – 1muflon1
    Nov 7, 2022 at 17:32
  • 1
    $\begingroup$ NW adjusts standard errors but leaves point estimates intact. So when you say the point of NW is to save consistency, it could not mean consistency of point estimates. Do you perhaps mean consistency of standard errors? And again, I would love to check out the source, but I could not find the handbook you are mentioning. Could you please give a more concrete reference? $\endgroup$ Nov 11, 2022 at 6:20

I've heard that a crucial problem for autocorrelation is not including an independent variable. Till now I was not including the 'year' as a variable in my regression. Would that help?

Yes it could help. Omitting a trend as explanatory variable usually generates autocorrelation. If the true DGP is: $$ y_t = \beta_0 + \beta_1 t + e_t, $$ with $E[e_t|t]=0, V[e_t|t]=\sigma^2, Cov[e_t,e_s|t,s]=0$, for $s \neq t,$ but if we omit $t$ and consider the misspecified model $$ y_t = \beta_0 + u_t, $$ then we have $Cov(u_t,u_{t-1})=\beta_1^2 V(t)$ (exercise).
Moreover, as discussed below @1mouflon1's answer, the OLS estimate $\hat{\beta}_0$ is not consistent for $\beta_0$ in this case (with an omitted variable bias).
These properties are illustrated by the R-code below.

library( data.table )
T = 100

t = seq(1:T)
e = rnorm(T)
beta_0 = 2
beta_1 = 1/2
y = beta_0 + beta_1*t + e
Dat = data.table( y, t, e  )
reg  = lm( y ~ 1 , data=Dat )
summary( reg ) # Illustrates that OLS is not consistent for beta_0

# Residuals
Dat_e = data.table( e_hat = reg$residuals ) 
Dat_e$e_hat_1 = shift( Dat_e$e_hat, type="lag" ) 

autocor_e  = lm( e_hat ~ e_hat_1, data=Dat_e )
summary( autocor_e ) # illustrates that residuals are AR1

# True error terms
u =  beta_1*t + e
Dat_u = data.table( u ) 
Dat_u$u_1 = shift( Dat_u$u, type="lag" ) 
# Check whether the theoretical result is (approximately) satisfied
cov( Dat_u$u, Dat_u$u_1, use="complete.obs" )
(beta_1)^2 * var( Dat$t )

autocor_u  = lm( u ~ u_1, data=Dat_u )
summary( autocor_u )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.