# [R-sig-ME] Sample size estimation

Doran, Harold HDoran at air.org
Thu Jun 28 14:46:55 CEST 2007

```The steps are pretty straightforward if you choose simulation.

1) Simulate data for a sample size s that meets your assumptions (e.g.,
effect size, variances, etc) based on the generating model
2) Run these data through lmer N times
3) Save the p-value at each iteration for the effect of interest in step
2. Save this as a dichotomous variable where 1 means p < .05
4) Compute the mean of the dichotomous variable in step 3. This is your
power at sample size s.
5) Repeat with a new sample size s.

With lmer, you don't get p-values. So, what I do is divide the fixed
effects by their standard errors to get the t-value and compare it to
the critical value associated with my level of significance desired.

You might find Gelman and Hill's book on multilevel models and a paper
you can google called "R as a tool for mathematical statistics" useful
since they both have the process and examples presented.

Harold

> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org
> [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf
> Of Chaudhari, Monica
> Sent: Wednesday, June 27, 2007 5:47 PM
> To: Douglas Bates; R-SIG-Mixed-Models
> Subject: [R-sig-ME] Sample size estimation
>
> Hello List,
>
> Can anybody guide me through the steps of sample size
> estimation for seeing the effect (at 5% level of
> significance) of the difference in the growth of outcome
> variable between two groups using Generalized Linear Mixed
> Model with quasipoisson family. The model is as given below:
>
> log(mu)= b0 + b1 time + b2 group + b3 time:group
>
> Any clue will be highly appreciated.
>
> Thanks,
> Monica
>
> #########################################################
> The information contained in this e-mail and subsequent
> attachments may be privileged, confidential and protected
> from disclosure.  This transmission is intended for the sole
> use of the individual and entity to whom it is addressed.  If
> you are not the intended recipient, any dissemination,
> distribution or copying is strictly prohibited.  If you think
> that you have received this message in error, please e-mail
> the sender at the above e-mail address.
> #########################################################
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

```