# What is the variance of a regression coefficient?

I'm having difficulty understanding conceptually and mathematically what is the variance of a regression coefficient. I have an autoregressive model of the type: $$y_t=\beta_1x_1+\beta_2x_2+\beta y_{t-1}+\beta_0$$ My goal is to calculate the Durbin h-statistic for this model, for which I need the variance of the coefficient on the lagged $y$ variable, $Var(\beta)$. Here's where I'm not sure how to calculate that. Is the variance of the coefficient on the lagged $y$ variable the variance explained by that predictor?

• $\sigma^2 (X'X)^{-1}$ is the formula for the variance covariance matrix. The variances are on the diagonal.
– Tony
Commented Jan 21, 2017 at 22:12
• @Tony That true for OLS, but this is an autoregressive model and therefore does not assume independent errors, which is a crucial assumption behind the formula you quote. The correct formula to use depends on how $\beta$ is estimated.
– whuber
Commented Jan 21, 2017 at 23:01
• @whuber Hmm, I have seen many estimate AR models using OLS. If the autocorrelation of errors is included in the estimate, then generally GLS is used and the variance can be obtained from: $\sigma^2 (X'WX)^{-1}$, where W is the inverse of variance/covariance of the errors. Use the following to find W: people.virginia.edu/~sns5r/classes/grad/econ772stf/gls.pdf
– Tony
Commented Jan 22, 2017 at 11:59

## 1 Answer

I believe this question is based on

https://stats.stackexchange.com/questions/257370/how-to-compute-the-durbin-h-statistic-in-r?noredirect=1#comment491815_257370

It seems that you may be doing your analysis in R, hence my example will uses R code.

library(car)

fit = lm(fconvict ~ tfr + partic + degrees + mconvict, data=Hartnagel)

n = nrow(Hartnagel)

s = summary(fit)

coef(s)
Estimate   Std. Error   t value     Pr(>|t|)
(Intercept) 127.63999736 59.957044218  2.128857 4.081885e-02
tfr          -0.04656651  0.008032987 -5.796911 1.754618e-06
partic        0.25341619  0.115131823  2.201096 3.483237e-02
degrees      -0.21204914  0.211453792 -1.002816 3.232469e-01
mconvict      0.05910466  0.045145314  1.309209 1.995067e-01
v = n * coef(s)[1, 2] ^ 2  ## std^2 -var
v
[1] 136604.2

d = durbinWatsonTest(model = fit)

durbinH <- (1 - 0.5 * d$dw) * sqrt(n / (1 - n*v)) Warning message: In sqrt(n/(1 - n * v)) : NaNs produced  As you see here, the durbinH statistic is not defined since$n \times var(\beta_1) \geq $. It seems Durbin H is not always defined so you may need to be cautious with this statistic. Refer to the wiki page: https://en.wikipedia.org/wiki/Durbin%E2%80%93Watson_statistic#Durbin_h-statistic However, there are other methods for detecting autocorrelation among the residuals. For example acf will produce an autocorrelation plot and statistics. • Thanks, @Jon. Just to confirm, in the case of the model I have, v would be the square of the std. error on the y lag one term, right? Commented Jan 21, 2017 at 22:50 • It is now the variance. Before I forgot to multiply by n to convert to variance, so in reality it was variance/n. The answer has been updated. – Jon Commented Jan 22, 2017 at 0:12 • While multiplying by n to convert to variance is correct, if I use this approach then n*v will almost always be >1. Reading more on the topic it seems that it's appropriate to square the standard error to get variance: academlib.com/1023/economics/durbins_test_statistic. Commented Jan 22, 2017 at 14:40 • I do not know how valid the reference you linked is, but they do use the standard error; in fact, they use the standard error of for the coefficient belonging to$y_{t-1}\$ instead of the intercept term which is different from what I remember Wikipedia had. I suggest looking into at least one more reference (or if you're in school, asking your teacher) to compare and validate procedures.
– Jon
Commented Jan 24, 2017 at 17:27