I am attempting to find a way to perform a power analysis for a higher order repeated measures ANOVA where all factors are within-subjects (i.e., there are no between-subjects factors). I have looked extensively for a way to do this using existing tools like SPSS, or GPower and other packages but have not found anything that seems appropriate. GPower does not seem to support power analysis for repeated measures designs where there are multiple within-subjects factors.

I am wondering if R is the right path to take to perform a power analysis of this type. I am just starting with R and was wondering if anyone had a script built for this? I found a script at the link below that seems promising but wanted to confirm that it is indeed for a power analysis of a design with ONLY within-subjects factors. The design I am interested in analyzing would have 2 factors, typically one with 2 levels and another with 3 or more. However, I also need to assess a much larger design with 4 factors. If the script in the thread linked below is for a totally within-subjects design, can it be expanded to include more factors? If so how?

Power analysis of repeated measures ANOVA using simulation in R?

  • $\begingroup$ I have a fairly extensive answer concerning using simulations for power analyses in this thread & @GregSnow's answer there provides a more practical complement. There are a couple of other relevant CV threads that are linked in my answer. The key question is, can you write down the model you think holds in the real world (ie the alternative hypothesis) w/ the requisite random intercept variances & covariances? If not, you need to ask a new Q to help you sort that out. Nb if you are just asking for code, this Q would be off-topic. $\endgroup$ – gung Jan 28 '14 at 15:19
  • $\begingroup$ Hi, thanks for getting back to me. The threads you suggested were very helpful. It is becoming clear that a simulation like Snow's based on pilot data is the way to go. I apologize but I do not entirely understand your question of 'can I write down the model I think holds in the real world'. Do you mean can I write out what I would expect to happen across the differing factors? Regarding the variance & covariance, as I said, I do have pilot data so should be able to determine that. If you could give me some guidance on what you are looking for, hopefully we can figure this out. Thanks $\endgroup$ – user37737 Jan 29 '14 at 17:59
  • $\begingroup$ If you have adequate pilot data, fit a model to that & then simulate from that model. $\endgroup$ – gung Jan 29 '14 at 18:06
  • $\begingroup$ yes, that is what I would like to do. To do so I would like to adapt the code presented by Greg Snow but my issue is that I am having trouble fully understanding all of his code. I have attempted to search for documentation for various commands in the code in order to understand it better but have had trouble making heads or tails of a lot of it. As I mentioned before I am completely new to R. To you have any suggestions on how I can go about understand that particular code better? Thank you $\endgroup$ – user37737 Jan 30 '14 at 21:01
  • $\begingroup$ You can ask questions about R code on Stack Overflow. Have you tried simply running it & trying different small changes to help figure it out? How much programming experience do you have? You can run the same simulation in many other software / programming languages, if you understand the logic. Note that that code is for logistic regression, whereas you need to simulate from your rmANOVA. If this is too difficult, you may need to work w/ a statistical consultant. $\endgroup$ – gung Jan 30 '14 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.