Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: aic statistic


From   [email protected]
To   [email protected]
Subject   st: RE: aic statistic
Date   Thu, 27 Oct 2005 14:33:46 EDT

In reading through the digest this morning I noticed  that there has been 
some discussion
of the AIC statistic. I wrote this little  AIC post estimation command a few 
months ago that can be used following programs  written using Stata's ML 
capability. It can be ammended for use with other  non-ML regression programs, like 
the glm command, by looking at the main  program's list of estimation 
results. Type  
. ereturn list

to see how results have been defined. Then simply change  the definitions 
listed here as needed. The key is that the main program has to  calculate a 
log-likelihood function.

Joseph Hilbe

* POST-ESTIMATION CALCULATION OF AIC STATISTIC   Joseph Hilbe 7Jul2005
program define aic
version 9.0
tempvar aic
local nobs  e(N)
local npred  e(df_m)
local df = e(N) - e(df_m)  -1
local llike   e(ll)
qui gen `aic' = ((-2*`llike') +   2*(`npred'+1))/`nobs'

di in gr _col(1)  "AIC Statistic =  " in ye %11.3f `aic' 
end
 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index