# Breusch–Godfrey test for the presence of serial correlation in the following example

Given the following regression by OLS:

$LIFE_t$=$\beta_0$+$\beta_1$$GDP_t+\beta_2$$GDP_{t-1}$+$\beta_3$$GDP_{t-2}+\beta_4$$LIFE_{t-1}$+$e_t$

and suppose I have 78 quarterly observations for both life expectancy (LIFE) and GDP per capita (GDP).

The question asks me to explain how I would run the Breusch-Godfrey test for the presence of serial correlation of order 4 (F test version) at 5% significance level.

I initially thought to find critical value, I need statistics for $F_{4,69}^{0.05}$ as $v_2$ = 78-5-4 =69

However, in the provided answer, $v_2$ = 78-4-2-9 =63.

I found this result puzzling. Could you please explain the intuition behind? Thank you!

Your initial regression with corresponding residuals will yield

$$\hat e_t = \mathit{LIFE}_t - \widehat{\mathit{LIFE}}_t \quad t = 3, \dots, 78$$

Thus, you will lose two observations ($76 = 78 - 2$) for starting values of the lagged $\mathit{GDP}_t$ and $\mathit{LIFE}_t$. Then, the auxiliary regression will be

$$\begin{eqnarray*} \hat e_t & = & \gamma_1 + \gamma_2 \cdot \mathit{GDP}_t + \gamma_3 \cdot \mathit{GDP}_{t-1} + \gamma_4 \cdot \mathit{GDP}_{t-2} + \gamma_5 \cdot \mathit{LIFE}_{t-1} + \\ & & \gamma_6 \cdot \hat e_{t-1} + \dots + \gamma_9 \cdot \hat e_{t-4} \end{eqnarray*}$$

and it depends on your initialization of the lagged $\hat e_t$ how many degrees of freedom you use.

1. One possible initialization is to consider all $\hat e_t$ missing for $t < 3$. Then you can run the regression above for $t = 7, \dots, 78$ (because $3 = 7 - 4$ giving the time of the first residual), i.e., $72$ observations. Having to estimate $9$ coefficients, this gives $63 = 72 - 9$ residual degrees of freedom.

2. Another possible initialization is to set all $\hat e_t = 0$ for $t < 3$, i.e., their expected value under correct specification of the model. Then you don't lose any additional observations ($t = 3, \dots, 78$) in the auxiliary regression and you get $67 = 76 - 9$ residual degrees of freedom.

Both strategies can be easily implemented in R using our bgtest() function from the lmtest package.

## artificial data with 78 observations
set.seed(0)
life <- ts(rnorm(78, mean = 75, sd = 2))
gdp <- ts(rnorm(78, mean = 5, sd = 1))

## lagged variables with 76 non-missing observations
d <- ts.intersect(life = life, life1 = lag(life, -1),
gdp = gdp, gdp1 = lag(gdp, -1), gdp2 = lag(gdp, -2))
nrow(d)
## [1] 76

## model
m <- lm(life ~ gdp + gdp1 + gdp2 + life1, data = d)

## Breusch-Godfrey test
bgtest(m, order = 4, fill = NA, type = "F")
##  Breusch-Godfrey test for serial correlation of order up to 4
##
## data:  m
## LM test = 0.34219, df1 = 4, df2 = 63, p-value = 0.8485
bgtest(m, order = 4, fill = 0, type = "F")
##  Breusch-Godfrey test for serial correlation of order up to 4
##
## data:  m
## LM test = 0.2467, df1 = 4, df2 = 67, p-value = 0.9107