# Correcting standard errors when the independent variables are autocorrelated

I have a question about how to correct standard errors when the independent variable has correlation. In a simple time series setting we can use Newey-West covariance matrix with a bunch of lags and that will take care of the problem of correlation in the residuals. What does one do in a panel data setting? Imagine the situation where you observe firms over time:

$$Y_{i,t} = a + b\Delta{X_{i,t}} + \epsilon_{i,t}$$

where the $\Delta{X_{i,t}} = X_{i,t} - X_{i,t-n}$. It seems that clustering standard errors on $i$ and on $t$ should fix this problem. Am I correct?

2. Calculate the Moulton factor and adjust your standard errors parametrically. If you have a balanced panel, the Moulton factor is $$M = 1 + (n-1)\rho_e$$ where $\rho_e$ is the within-individual correlation of the error. You then just need to multiply your standard errors with this factor in order to obtain an appropriate inflation of the naive standard errors which will correct for autocorrelation.