Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <n.j.cox@durham.ac.uk> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: difficulty with aflogit command |
Date | Mon, 30 May 2011 18:29:33 +0100 |
Just to underline that Richard's advice here is nearer the mark than my earlier comments. Nick n.j.cox@durham.ac.uk Richard Williams With user-written postestimation commands, you often need to run the estimation command under version control. This is because ereturned results can change across versions of Stata, and the post-estimation command was written for an older format. Also, it may be that aflogit doesn't like variable names that are more than 8 characters, which I am guessing was Stata's limit way back when. The following code seems to work: sysuse auto, clear version 10: logit foreign mpg rep78 aflogit clonevar displace = displacement poisson price weight displace aflogit At 12:54 AM 5/29/2011, Ari Samaranayaka wrote: >I am having difficulty with the user-written command aflogit. >Although it is expected to work after unconditional logit or poisson >it does not work for me. > >sysuse auto,clear >logit foreign mpg rep78 >aflogit > >this produce > >Logistic regression Number of obs >= 69 > LR chi2(2) >= 33.10 > Prob > chi2 = >0.0000 >Log likelihood = -25.851693 Pseudo R2 = >0.3903 >------------------------------------------------------------------------------ > foreign | Coef. Std. Err. z P>|z| [95% > Conf. Interval] >-------------+---------------------------------------------------------------- > mpg | .1328672 .0735776 1.81 0.071 -.0113423 >.2770767 > rep78 | 1.73607 .4928761 3.52 0.000 .7700508 >2.70209 > _cons | -10.03775 2.407455 -4.17 0.000 -14.75628 >-5.319226 >------------------------------------------------------------------------------ >. >. aflogit >Can only be used after unconditional logistic or poisson regression >last estimates not found >r(301); > >Then I used the following. > >poisson price weight displacement >aflogit > >This produces > >Poisson regression Number of obs >= 74 > LR chi2(2) = >29652.15 > Prob > chi2 = >0.0000 >Log likelihood = -29162.101 Pseudo R2 = >0.3370 > >------------------------------------------------------------------------------ > price | Coef. Std. Err. z P>|z| [95% > Conf. Interval] >-------------+---------------------------------------------------------------- > weight | .0003235 4.52e-06 71.55 0.000 .0003147 >.0003324 >displacement | .0000446 .000037 1.20 0.228 -.000028 >.0001172 > _cons | 7.708671 .0081077 950.79 0.000 7.69278 >7.724561 >------------------------------------------------------------------------------ > >. aflogit > >Population attributable fraction from poisson regression >Cross-sectional / cohort data (n=74) > > >Term Ref. A.F. s.e. [95% Conf. Int.]* >---------------------------------------------------------- >weight 0 0.6355 11.9561 -3.03e+27 1.0000 >ment not found >r(111); > >Can someone help me. >I am using stata SE 11.2. >my version of aflogit is >c:\ado\plus\a\aflogit.ado >*! version 1.0.6 16 Sep 1997 STB-42 sbe21 > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/