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

# RE: st: FW: population attritutable risk fraction and xi in logistic regression

 From "Fitzmaurice, Ann E." To "statalist@hsphsun2.harvard.edu" Subject RE: st: FW: population attritutable risk fraction and xi in logistic regression Date Sat, 7 May 2011 18:33:51 +0100

```Thank you for your comments, I have managed to get the logistic regression working and the code is below , I realise the if might looks a bit messy but it works,

I looked at using aflogit, but have found punaf, which generates the population attributable fraction, but am unsure of what the output means

Looking at the punaf code below, the variable bir_grp2 is the exposure I am interested in and it has four levels with the reference category the fourth, does the output give the parf for the first birth group??????

Regards

Ann

xi: logistic preterm2 i.bir_grp2 i.age_gp2a i.ht_grp1a i.delt2a_m i.lab_ty2a  i.dcom_mr ///
i.bpre2c i.bsex2a i.pet2a_mr  i.uti2a_mr i.aph2a_mr i.age_gp2a*i.bir_grp2 ///
i.ht_grp1a*i.bir_grp2   i.delt2a_m*i.bir_grp2  i.lab_ty2a*i.bir_grp2  ///
i.aph2a_mr*i.bir_grp2 if (preterm2 ~= . & gestgrp2 >= 1 & bir_grp2 >= 1 & age_gp2a >= 1 & ///
ht_grp1a >= 1 & mstat2b >= 0 & hsc2a_mr >= 1 ///
&delt2a_m>=1 &lab_ty2a>=1&bpre2c>=1 &  bsex2a>=1 ///
& age_gp2a ~= .  ///
& ht_grp1a ~= . & mstat2b ~= . & hsc2a_mr ~= . ///
&delt2a_m ~= . &lab_ty2a ~= . &bpre2c ~= . &  bsex2a ~= .),  or

punaf, at(_Ibir_grp2_1) eform

downladed within stata  using ssc install
PUNAF: Stata module to compute population attributable fractions for cohort studies

http://ideas.repec.org/c/boc/bocode/s457193.html

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 07 May 2011 16:15
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: FW: population attritutable risk fraction and xi in logistic regression

The difficulty you had with -xi:- that "it did not like interactions"
makes no sense; the whole point of -xi:- is to support interactions.
Your specific difficulty can not be addressed if you do not show the
code.

The other difficulty with -aflogit- I cannot advise on, but everyone
is asked to explain where user-written programs they use come from. In
this case

STB-42  sbe21 .  Adjusted pop. attributable fractions from logistic regression
(help aflogit if installed) . . . . . . . . . . . . . . . . . A. Brady
3/98    pp.8--12; STB Reprints Vol 7, pp.137--143
estimation of the attributable fraction (AF) from within a
logistic regression framework, thus enabling confounders to
be taken into account, and allows estimation of the summary
AF for a set of exposures

Nick

On Sat, May 7, 2011 at 3:13 PM, Fitzmaurice, Ann E.
<a.e.fitzmaurice@abdn.ac.uk> wrote:

> I would like to calculate the PAFR after logistic regression  with and without interactions of the form-
>
> Logistic dependent var1 list of variables var1*each of the variables in the list using xi
>
> Var1 has four groups , and this is where I think the problem may be
>
> The first problem got was that the use of xi did not like interactions (do not understand why), so I removed the interactions, but using aflogit, this couldn't find  var1
>
> This is the command I used
>
> aflogit bir_grp2, cc
>
> can anyone explain how to get this fraction from the adjusted model , can it be calculated in stata or by hand and if so does anyone have an example that I can follow
>

*
*   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/

The University of Aberdeen is a charity registered in Scotland, No SC013683.

*
*   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/
```