Hello, folks its time to cover some important econometrics tests you can do in R.
The Akaike information criterion is a measure of the relative goodness of fit of a statistical model. If you have 10 models and order them by AIC, the one with the smallest AIC is your best model, ceterus paribus.
The following code can figure the AIC and a similar version called BIC:
Say we wish to see if our model has an error term that follows a relatively normal distribution. For this we can perform the Jarque-Bera which tests kurtosis as well as skewness. This function requires that you load the FitAR package.
To see if the mean of the residual values is 0 and to see the standard deviation the following code works:
Other tests like the Breusch-Pagan and Goldfeld-Quandt provide facts like wether autocorrelation is present and give us a hint as to wether our residual variance is stable or not. In order for these to work you have to load the lmtest package. Also you can only run these for the lm objects or for your Ordinary Least Squares Regressions for any Generalized Least Squares regressions you’ll have to perform these test manually, and if you know of an easier or softer way please share.
studentized Breusch-Pagan test
BP = 48.495, df = 12, p-value = 2.563e-06
GQ = 0.1998, df1 = 40, df2 = 40, p-value = 1
You can also use the Durbin-Watson to test for first order autocorrelation:
DW = 1.4862, p-value = 0.0001955
alternative hypothesis: true autocorrelation is greater than 0
Wish to get confidence intervals for your parameter estimates? Then use the confint() function as shown below for the Generalized Least Squares regression on long-term risk premia from 2001-2011.
I hope this mini-series has been informative to all that tuned in. For more info on anything you see here please don’t be shy to comment and keep dancin’,