Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: difficulty with aflogit command

From   Roger Newson <>
To   "" <>
Subject   Re: st: difficulty with aflogit command
Date   Mon, 30 May 2011 11:43:06 +0100

If you ara analysing data from a cohort or cross-sectional study (instead of a case-control studu), and if you have Stata Version 11, then you might like to use the -punaf- package (downloadable from SSC), which computes population unattributable and attributable fractions with confidence limits. I have plans to write a version for case-control studies, but haven't done so yet.

I hope this helps.

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 29/05/2011 16:35, Richard Williams wrote:
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.

As to why it stopped working in Stata 11 -- aflogit.ado includes the code

          #delimit ;
          if "$S_E_cmd" != "logistic"&  "$S_E_cmd" != "logit"&
"$S_E_cmd" != "blogit"
           &  ("$S_E_cmd" != "glm" | "$S_E_fam" != "bin" | "$S_E_link" != "l")
           &  ("$S_E_cmd" != "glm" | "$S_E_fam" != "poi")
           &  "$S_E_cmd" != "poisson" {;
                  disp in red "Can only be used after unconditional
logistic or poisson regression";
                  error 301;

For whatever reason, it appears that Stata's -logit- stopped setting
those macros starting with version 11. If somebody were so inclined,
they could probably rewrite aflogit using e(cmd) instead.

aflogit was written for version 5 of Stata, so presumably you could
get it to work with any supported command by doing something like

version 5: command...

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu

*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index