*
* @regCrits
*
* RegCrits is a post-processor for a linear regression which computes and
* (optionally) displays various information criteria. It has no parameters, as it
* just picks the information off from the accessible variables.
*
* This should be used immediately after LINREG, NLLS or BOXJENK.
*
* It computes the Akaike Information Criterion, Schwarz Bayesian Criterion,
* Hannan-Quinn, and FPE. These are all done in log form, so their values
* will look fairly similar. Of course, the key to their use is the
* comparison across models of a particular criterion.
*
* This defines %AIC (Akaike), %SBC (Schwarz), %HQCRIT (Hannan-Quinn) and
* %LOGFPE (log of the FPE).
*
* Formulas are
*   AIC  -2*logL/T+2*k/T
*   SBC  -2*logL/T+log(T)*k/T
*   HQ   -2*logL/T+2*log(log(T))*k/T
*   FPE  -2*logL/T+log(T+k/T-k) (log of the standard formula)
*
*   where logL is the log likelihood, k is the number of
*   regressors and T is the number of observations.
*
* Revision Schedule:
*   02/2003 Written by Tom Doan. Estima.
*   06/2005 Revised to use %LOGL rather than sum of squared residuals
*
procedure RegCrits
option switch print 1
*
declare real %aic %sbc %hqcrit %logfpe
compute %aic    = -2.0*%logl/%nobs+2.0*%nreg/%nobs
compute %sbc    = -2.0*%logl/%nobs+log(%nobs)*%nreg/%nobs
compute %hqcrit = -2.0*%logl/%nobs+2.0*log(log(%nobs))*%nreg/%nobs
compute %logfpe = -2.0*%logl/%nobs+log(float(%nobs+%nreg)/(%nobs-%nreg))
if .not.print
   return
disp "AIC" @20 %aic
disp "SBC" @20 %sbc
disp "Hannan-Quinn" @20 %hqcrit
disp "(log) FPE" @20 %logfpe
end


