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]

st: New version of -punaf- on SSC

From   Roger Newson <>
To   "" <>
Subject   st: New version of -punaf- on SSC
Date   Wed, 05 Oct 2011 12:47:37 +0100

Thanks yet again to Kit Baum, a new version of the -punaf- package is now available for download from SSC. In Stata, use the -ssc- command to do this, or -adoupdate- if you already have an old version of -punaf-,

The -punaf- package is described as below on my website. The new version has been updated to Stata Version 12. This fixes a problem with the old Stata Version 11 -punaf-, which could not run in Stata Version 12 because of a change in the -margins- command during the version change. I have also added a new option -atzero()-, which allows the user to define a baseline scenario other than the real world from which the data were sampled, and to compare this fantasy baseline scenario with the fantasy alternative scenario specified by the -atspec()- option. For instance, in the example dataset -lbw.dta-, which the user can download by typing

use, clear

in Stata, it is possible now to use a logistic regression model for the outcome of low birthweight, and to use -punaf- to estimate the rate ratio between a fantasy dream scenario in which no pregnant women smoke and a fantasy nightmare scenario in which all pregnant women smoke.

Stata 11 users can still download the old Stata 11 version of -punaf- from my website by typing, in Stata,

net from "";

and selecting and installing -punaf-.

I would like to thank Andrew ( again for alerting me to the catastrophic version-change bug on Statalist. I would also like to thank Kristin MacDonald at Stata Tech-Support for some helpful discussions last year about how I might extend the methods of -punaf- and -margins- to calculate population unattributable and attributable fractions for case-control models and/or Cox regression. I am returning to this problem now. And thanks to StataCorp for their amazingly powerful -margins- command which made -punaf- possible.

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.

package punaf from

      punaf: Population attributable fractions for cohort studies

      punaf calculates confidence intervals for population attributable
      fractions, and also for scenario means and their ratio, known as
      the population unattributable fraction.  punaf can be used after
      an estimation command whose predicted values are interpreted as
      conditional arithmetic means, such as logit, logistic, poisson,
      or glm.  It estimates the logs of two scenario means, the
      baseline scenario ("Scenario 0") and a fantasy scenario
      ("Scenario 1"), in which one or more exposure variables are
      assumed to be set to particular values (typically zero), and any
      other predictor variables in the model are assumed to remain the
      same.  It also estimates the log of the ratio of the Scenario 1
      mean to the Scenario 0 mean.  This ratio is known as the
      population unattributable fraction, and is subtracted from 1 to
      derive the population attributable fraction, defined as the
      proportion of the mean of the outcome variable attributable to
      living in Scenario 0 instead of Scenario 1.

      Author: Roger Newson
      Distribution-Date: 04october2011
      Stata-Version: 12

INSTALLATION FILES                                  (click here to install)
(click here to return to the previous screen)
*   For searches and help try:

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