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.
2.5 % 97.5 %
yc -0.1455727340 0.1498852728
default 0.2994818014 1.0640354237
Volatility 0.0336077958 0.0617798767
CorporateProfit -0.0010916473 0.0006628209
FF -0.1788624533 0.0931406285
ER 0.0001539035 0.0016060804
Fedmbs -0.0061554994 0.0085638593
Support -0.1499342096 0.1615652273
FedComm -0.0108567077 0.0750407328
FedGdp -0.1347070955 0.2528217710
ForeignDebt -0.0441198164 0.1042805549
govcredit 0.1090847204 0.6796839003
FedBalance -2.0940925835 0.0370114069
UGAP -0.4821566147 0.3188891550
OGAP -0.2239749029 0.1073611677
Another nice feature is finding the log-likelihood of your estimation:
'log Lik.' 23.05106 (df=17)
Want to see if you have a unit-root in your residual values? Then perform the augmented Dickey-Fuller. For this you'll have to load the 'tseries' package.
Augmented Dickey-Fuller Test
Dickey-Fuller = -7.4503, Lag order = 3, p-value = 0.01
alternative hypothesis: stationary
In adf.test(lrp2.gls$res[-(1:4)]) : p-value smaller than printed p-value> adf.test(lrp2.lm$res)
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',