Using gret l for Principles of Econometrics, 4th Edition
Testing for Normality
Your book, Principles of Econometrics, discusses the Jarque-Bera test for normality which is computed using the skewness and kurtosis of the least squares residuals. To compute the Jarque- Bera statistic, you’ll first need to estimate your model using least squares and then save the residuals to the data set.
From the gretl console
1 ols food_exp const income
2 series uhatl = $uhat
3 summary uhatl
The first line is the regression. The next accesses the least squares redsiduals, $uhat, and places
them into a new series called uhatl.5 You could also use the point-and-click method to add the residuals to the data set. This is accomplished from the regression’s output window. Simply choose Save>Residuals from the model pull-down menu to add the estimated residuals to the dataset. The last line of the script produces the summary statistics for the residuals and yields the output in Figure 4.12. One thing to note, gretl reports excess kurtosis rather than kurtosis. The excess
Summary Statistics, using the observations 1-40 for the variable ’uhat!’ (40 valid observations)
Mean
Median
Minimum
Maximum
Standard deviation C. V.
Skewness Ex. kurtosis
Figure 4.12: The summary statistics for the least squares residuals.
kurtosis is measured relative to that of the normal distribution which has kurtosis of three. Hence, your computation is
JB = T ^Skewness2 + (Excess Kurt°sis)^ (4.7)
5You can’t use uhat instead of uhatl because that name is reserved by gretl.
|
|||
|
|
||
|
|||
Normal random variables have no skewness nor any excess kurtosis. The JB statistic is zero in this case. It gets larger the higher the skewness and the greater the degree of excess kurtosis displayed by the data. In section C.1 hansl is used to compute skewness and excess kurtosis and you could use these computations to compute your own JB test. Fortunately, there is no need to compute your own because gretl will compute the Jarque-Bera test for you. After saving the residuals into $uhat1 issue the command
ols food_exp const income series uhatl = $uhat normtest uhatl —jbera normtest uhat1 —all
This yields a value of Jarque-Bera test = 0.0633401, with p-value 0.968826, which is exactly what the manual calculation yields. Gretl performs other tests for the normality of residuals including one by Doornik and Hansen (2008). Computationally, it is more complex than the Jarque-Bera test. The Doornik-Hansen test has a x2 distribution if the null hypothesis of normality is true. It can be produced from normtest along with several others using the --all option. Output from normtest —all is shown in Figure 4.13. Obviously, one of the advantages of using normtest is
that you can test for the normality of any series, not just residuals.
Another possibility is to use the modtest function after estimating a model using least squares.
ols food_exp const income modtest —normality
The modtest command is actually is a generic function that allows you to test a number of different hypotheses regarding the specification of your model. This function operates on the residuals of
Frequency distribution for uhat2, obs 1-40 number of bins = 7, mean = -2.45137e-014, sd = 89.517
Test for null hypothesis of normal distribution: Chi-square(2) = 0.694 with p-value 0.70684 |