[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Newson, Roger B" <r.newson@imperial.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: CI for a difference in proportions |

Date |
Wed, 27 Feb 2008 21:54:00 -0000 |

I can think of 2 possibilities. One is to use -glm-, with the options -family(binomial) link(identity)-, to get estimation results for a proportion for Group 1 and a Group 2 - Group 1 difference between proportions. As in: glm event group2, family(binomial) link(identity) where event is the binary outcome variable (with values 0 and 1), and group2 is an indicator (with values 0 an 1) indicating membership of group 2 rather than group 1. The parameter named _cons will be the proportion of individuals for which the event happened in group 1, and the parameter labelled group2 will be the difference between the proportion of individuals for which the event happened in group 2 and the proportion of individuals for which the event happened in group 1. Both of these parameters have estimates and standard errors, which can be extracted for further processing, using -parmby-, -statsby-, -estout-, -outreg- etc. A better alternative is probably to use the -somersd- package, downloadable from SSC. This can calculate differences between proportions, and confidence intervals for these, because a difference between proportions is a special case of Somers' D when both the Y-variable and the X-variable are binary. The -somersd- package has the advantage of offering Normalizing and variance-stabilizing transformations for differences between proportions, allowing confidence intervals in which we can probably be more confident. In our case, we might type somersd group2 event, transf(z) tdist and 2 confidence intervals will be displayed, one for the hyperbolic arctangent (or z-transform) of the difference between proportions, and one for the difference between the proportions itself. Again, the estimates and standard errors of the z-transformed difference can be extracted using -statsby-, -parmby-, -parmest-, -estout- etc. and then back-transformed using the -tanh()- function. I hope this helps. Best wishes Roger Roger B Newson 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 UNITED KINGDOM Tel: +44 (0)20 7352 8121 ext 3381 Fax: +44 (0)20 7351 8322 Email: r.newson@imperial.ac.uk Web page: www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop genetics/reph/ Opinions expressed are those of the author, not of the institution. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Antoine Terracol Sent: 27 February 2008 19:19 To: statalist@hsphsun2.harvard.edu Subject: st: CI for a difference in proportions Dear _all, This might be a silly question, but I currently have no access to Stata's user manuals or stats textbook. I have data on two independant samples (of different sizes), each observed over 20 periods. I wish to draw a graph representing, for each period, the difference in the proportion of some event between the two groups, together with the 95% CI for this difference. I first wanted to use -prtest- for each period, store/compute the differences and CI bonds in new variables, and graph them against periods. However, I am a bit confused over which standard error to use (and how to get them) when computing the CI bounds. -prtest- gives two standard errors, the one under H0 can be easily computed from stored results r(P_1), r(P_2) and r(z). The standard errors for each proportion (se1 and se2) are not stored, and I do not know if the fact that my calculation of sqrt(se1^2 + se2^2) differs from the reported standard error for the difference (not under H0) is caused by rounding errors or if my formula is incorrect... I thought of using -proportion- to get the standard errors as stored results, but it actually gives standard errors for each proportion that differ from -prtest-, but are identical to the ones computed by -mean-. Any advice would be appreciated. Antoine * * 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/ * * 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/

**References**:**st: CI for a difference in proportions***From:*Antoine Terracol <terracol@univ-paris1.fr>

- Prev by Date:
**st: RE: How to sample from a Multinomial distribution** - Next by Date:
**Re: st: Critical values for stock and yogo test when the clusteroption is used** - Previous by thread:
**st: CI for a difference in proportions** - Next by thread:
**Re: st: CI for a difference in proportions** - Index(es):

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