Using gret l for Principles of Econometrics, 4th Edition
Lagrange Multiplier Tests
There are many tests of the null hypothesis of homoskedasticity that have been proposed elsewhere. Two of these, based on Lagrange multipliers, are particularly simple to do and useful. The first is sometimes referred to as the Breusch-Pagan (BP) test. The second test is credited to White.
The null and alternative hypotheses for the Breusch-Pagan test are
Ho : a2 = a2
Hi : a2 = h(ai + 0:2^2 + ... asZis)
The null hypothesis is that the data are homoskedastic. The alternative is that the data are heteroskedastic in a way that depends upon the variables zis, i = 2, 3,..., S. These variables are exogenous and correlated with the model’s variances. The function h(), is not specified. It could be anything that depends on its argument, i. e., the linear function of the variables in z. Here are the steps:
1. Estimate the regression model
2. Save the residuals
3. Square the residuals
4. Regress the squared residuals on zis, i = 2,3,... ,S.
5. Compute NR2 from this regression and compare it to the a level critical value from the X2(S — 1) distribution.
The gretl script to perform the test manually is
1 ols food_exp const income
2 series sq_ehat = $uhat*$uhat
3 ols sq_ehat const income
4 scalar NR2 = $trsq
5 pvalue X 1 NR2
The only new item in this script is the use of the accessor, $trsq. This is the saved value of NR2 from the previously estimated model. The output from the script is
1 Replaced scalar NR2 = 7.38442
2 Chi-square(1): area to the right of 7.38442 = 0.00657911
3 (to the left: 0.993421)
The p-value is less than 5% and we would reject the homoskedasticity null at that level. The heteroskedasticity seen in the residual plots appears to be confirmed.
Gretl has a built-in function that will compute a special case of the BP test that yields the same result in this example. The
2 modtest —breusch-pagan
Produces
Breusch-Pagan test for heteroskedasticity OLS, using observations 1-40 Dependent variable: scaled uhat"2
coefficient std. error t-ratio p-value
const -0.756949 0.633618 -1.195 0.2396
income 0.0896185 0.0305534 2.933 0.0057 ***
Explained sum of squares = 14.6879
Test statistic: LM = 7.343935,
with p-value = P(Chi-square(1) > 7.343935) = 0.006729
White’s test is in fact just a minor variation on the Breusch-Pagan test. The null and alternative hypotheses are
H0 : of = a2 for all i
H : a2 = a2 for at least 1 i = j
This is a composite alternative that captures every possibility other than the one covered by the null. If you know nothing about the nature of heteroskedasticity in your data, then this is a good place to start. The test is very similar to the BP test. In this test, the heteroskedasticity related variables (zis, i = 2,3,... ,S) include each non-redundant regressor, its square, and all cross products between regressors. See POE4 for details. In the food expenditure model there is only one continuous regressor and an intercept. So, the constant squared and the cross product between the constant and income are redundant. This leaves only one unique variable to add to the model, income squared.
In gretl generate the squared value of income and regress the squared residuals from the model on income and its square. Compute NR2 from this regression and compare it to a level critical value from the x2(S — 1) distribution. As is the case in all the LM tests considered in this book, N is the number of observations in the second or auxiliary regression.
As with the BP test there is a built-in function that computes White’s test. It generates all of the squares and unique cross-products to add to the model. The script to do both manual and built-in tests is found below:
1 ols food_exp const income
2 series sq_ehat = $uhat*$uhat
3 series sq_income = income"2
4 ols sq_ehat const income sq_income
5 scalar NR2 = $trsq
6 pvalue X 2 NR2
7
7 ols food_exp const income —quiet
8 modtest —white —quiet
The results from the two match perfectly and only that from the built-in procedure is produced below:
White's test for heteroskedasticity Test statistic: TR"2 = 7.555079,
with p-value = P(Chi-square(2) > 7.555079) = 0.022879
The homoskedasticity null hypothesis is rejected at the 5% level.