Statalist The Stata Listserver

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

st: RE: Re: power analysis for panel data

From   "Newson, Roger B" <>
To   <>
Subject   st: RE: Re: power analysis for panel data
Date   Tue, 7 Nov 2006 20:02:23 -0000

A possible tool to use in this case might be my -powercal- package,
downloadable from SSC using the -sc- command, which can be used to
compute generalized power and sample size calculations. -powercal-, and
the methods used, are described in a Stata Journal paper (Newson, 2004),
which you can download in pre-publication draft form from my website
(see below) if you do not have access to that issue of The Stata
Journal. Essentially, given a pilot study to measure a parameter of
interest, you can use the standard error of that parameter and the
sample size (number of clusters) from that pilot study to calculate
curves of power and/or sample size and/or detectable effect size and/or
achievable P-value, using -powercal-, to ascertain how large a study you
would have to plan to detect an interesting parameter size.

The Stata Journal website is at
and contains information about how to subscribe to The Stata Journal and
to order specific issues.

I hope this helps.

Best wishes



Newson R. Generalized power calculations for generalized linear models
and more. The Stata Journal 2004; 4(4): 379-401. Download
pre-publication draft from my website at

Roger 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
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322

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

-----Original Message-----
[] On Behalf Of Christopher
W. Ryan
Sent: 07 November 2006 18:58
Subject: st: Re: power analysis for panel data

I was not very explicit in my original question.

To be more clear:

I'm conducting an observational study on the effect of simple office
advice by the physician on a patient's obesity (measured by BMI). I have
an unbalanced panel: roughly 100 patients observed for about two years.
 But they made their visits based on clinical needs, so the number of
visits varies from patient to patient.  I've "condensed" their visits
into one representative visit per quarter per patient--but not all
patients have a visit in any particular quarter.  qdate is the quarterly
date variable.

The patients are a 10% random sample of all the patients with BMI >= 30,
who made visits to our practice during a specified interval.  The
selected patients' charts were then abstracted, using every visit
subsequent to the index visit, for the ensuing 2.5 years.

So then I use -xtreg- with fe to examine the effect of a previous
visit's advice on the current visit's BMI.  So the independent variables
are lagged.  "Advice" can be to follow a certain diet, to exercise, to
see a dietician, to join a self-help group, etc.  Diet advice and
exercise advice are ordinal:  none, non-specific, or specific.  I also
look at the effects of charting the obesity in certain ways, and whether
the diagnosis of obsesity was "officially" entered into the chart.

Here is some of the output.

. xi:xtreg bmi qdate Lobsub Lobassess Lobicd9 i.Ldietadvice
i.Lexeradvice Ldietician Lbecouns
> Lmeds Lsurgery Lshgroup, fe

i.Ldietadvice     _ILdietadvi_0-2     (naturally coded; _ILdietadvi_0
i.Lexeradvice     _ILexeradvi_0-2     (naturally coded; _ILexeradvi_0

Fixed-effects (within) regression     Number of obs      =       272
Group variable (i): mrnumber          Number of groups   =        98

R-sq:  within  = 0.1510               Obs per group: min =         1
       between = 0.1323                              avg =       2.8
       overall = 0.0767                              max =         6

                                      F(13,161)          =      2.20
corr(u_i, Xb)  = 0.2001               Prob > F           =    0.0115

         bmi |      Coef.   Std. Err.      t    P>|t|
       qdate |   -.077571   .0607539    -1.28   0.204
      Lobsub |   .2856105   .3644859     0.78   0.434
   Lobassess |    -1.3555   .6527376    -2.08   0.039
     Lobicd9 |   1.408771   .6667927     2.11   0.036
_ILdietadv~1 |   .2555625   .6827685     0.37   0.709
_ILdietadv~2 |   1.912082   .7939111     2.41   0.017
_ILexeradv~1 |  -.1791865   .5411985    -0.33   0.741
_ILexeradv~2 |   .3961547   1.153241     0.34   0.732
  Ldietician |  -.5891818   .8675808    -0.68   0.498
    Lbecouns |  -1.180993   1.698886    -0.70   0.488
       Lmeds |   .3907819   1.052359     0.37   0.711
    Lsurgery |    4.65996   1.598309     2.92   0.004
    Lshgroup |   3.550525   1.706046     2.08   0.039
       _cons |   51.30236   11.05319     4.64   0.000
     sigma_u |  5.4841536
     sigma_e |  1.3633508
         rho |  .94179599   (fraction of variance due to u_i)
F test that all u_i=0:   F(97, 161) =    46.51    Prob > F = 0.0000

The lack of any statistically significant beneficial effect of any of
the interventions on BMI does not surprise me, given the generally
intractable nature of obesity.  The general futility of simple
office-based exhortations to lose weight is part of my point.

But what is the power of this study?  I don't know how to calculate
that.  Am I failing to see statistically significant beneficial effects
on BMI because of inadequate power?

Hence my question about resources or references about power and sample
size calculations in panel analysis.

Thanks for any advice or pointers to references.

Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
and Wilson Family Practice Residency, Johnson City, NY
GnuPG and PGP public keys available at

"If you want to build a ship, don't drum up the men to gather wood,
divide the work and give orders. Instead, teach them to yearn for the
vast and endless sea."  [Antoine de St. Exupery]

Rodrigo A. Alfaro wrote:
> I am assuming that power is computed for fixed T. 
> Rodrigo.
> ----- Original Message ----- 
> From: "Christopher W. Ryan" <>
> To: "Statalist" <>
> Sent: Monday, October 16, 2006 10:08 PM
> Subject: st: power analysis for panel data
> Can anyone direct me to any resources that would help me understand
> power analysis in the context of panel data?  Thanks.
> --Chris
*   For searches and help try:

*   For searches and help try:

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