Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Power Analysis in 2-Level Hierarchical Linear Model

 From Jeph Herrin To statalist@hsphsun2.harvard.edu Subject Re: st: Power Analysis in 2-Level Hierarchical Linear Model Date Tue, 16 Apr 2013 09:09:32 -0400

```I am often called upon to do power calculations for 2 and 3 level HLMs. There are two approaches I usually use:

```
1. If trying to detect a main effect (ie, make a comparison between two groups), I use the methods of [Donner A, Klar D, The Design and Analysis of Cluster Randomized Trials. 2000. Arnold] and others to calculate sample size based on a t-test or chi-square test, adjusted for clustering via a variance inflation factor (VIF). In essense, one makes the usual power calculation but inflates the variance by a factor of VIF=(1+rho*(m-1)) where m is the average number of observations per group and rho is the (usually estimated) intra-cluster correlation. Then I will assume (or at least claim...) that actual power will likely be greater using a model.
```
```
2. For more complicated models, or situations where I know enough to do so, I use simulation. See http://www.stata-journal.com/sjpdf.html?articlenum=st0010 (or if the link doesn't work, The Stata Journal (2002) 2, Number 2, pp. 107–124 : Power by simulation). Basically, simulate a large number of data sets using known effects of interest and some reasonable assumptions about the distributions, estimate the model on each, and count the number of times that P< 0.05, where P is the p-value for the test of interest. The main drawback to doing this is that xtmixed can take a few minutes to converge, and 1000 x a few minutes ~ 2 days.
```
hope this helps,
Jeph

On 4/16/2013 2:04 AM, Anthony Fulginiti wrote:
```
```Hello Statalist,

I have enjoyed following the creative and informative insights and guidance on Statalist over the past few months.

I am interested in performing a power analysis in a 2-level hierarchical linear model (more specifically, a growth curve model).

Let's use the example of 80 clusters (individuals) with 10 per cluster (observations). If it is helpful, the code for the model is:

xtmixed Self-Esteem time time2 Program ProgramBytime ProgramBytime2|| id: time, covariance(un) variance mle

I ran a basic search in the Statalist archives and searched for power analysis options in Stata but did not find any information on the subject for hierarchical linear models. I have been reviewing material that recommends the use of Optimal Design software or PinT (Power in Two-level Designs) for power analysis in hierarchical linear modeling.  However, I have a Mac and both programs seem to run on Windows (my Windows platform has been giving me problems).

Is it possible to perform a power analysis with a 2-level hierarchical linear model in Stata?

If not, I would welcome any further recommendations for performing the analysis.

Respectfully, Anthony

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```