I'm looking for ways to estimate the sample size for a within-subject repeated measures design with continuous moderators. There are two conditions with 5 stimuli per condition, and each participant sees all of them. Analytic strategy will be a linear mixed model (using the lme4 package in R).

First I need a simple method, based on an effect size estimate. I've tried the smpsize_lmm function from the sjstats package, but I'm unsure whether it can be applied to my case. https://strengejacke.github.io/sjstats/reference/samplesize_mixed.html

samplesize_mixed(eff.size = .5, df.n = 5, k = 2, power = .8)

Is this appropriate for a fully within-design? k is for the number of level-2 clusters, but since all participants are completing all conditions there are no level-2 clusters in my case (or am I getting this wrong?) ... I still entered 2 here for the number of conditions, as the formula doesn't work with df.n = 10 and k = 1. Could someone tell me if I can use this for my case, or point me towards a more appropriate but ideally equally straightforward method for my design?

EDIT: some clarification/additional information:

By continuous moderator I mean that these are metric variables, not categorical variables. Moderators are at subject level and I'm mainly interested in the interaction between the moderators and the condition, expecting a hybrid interaction.

This is the model I'm planning to run:

model <-lmer(dv~ 1 + (1|subject) +  m1*cond + m2*cond, data, na.action = na.omit)
  • $\begingroup$ We need much more information. What do you mean by continuous moderators? What is the eventual lmer or lme model you plan to run? There are no simple ways to calculate power for this design. You will need to use simulation. Check out simglm and simr. cran.r-project.org/web/packages/simglm/vignettes/… humburg.github.io/Power-Analysis/simr_power_analysis.html $\endgroup$
    – Erik Ruzek
    Feb 11 at 20:44
  • $\begingroup$ @Erik Ruzek Thank you, I will have a look. I've added some clarifying information to the post! $\endgroup$
    – strubadur
    Feb 12 at 11:16
  • $\begingroup$ Are you interested in the sample size needed to give you sufficient power to detect a condition effect or a moderation effect? If moderation, are the moderators at the subject level (e.g., sex or race) or at the stimuli level? Know ahead of time that moderation effects are harder to detect than main (condition) effects, meaning you are going to need more data to have sufficient power to detect moderation. statmodeling.stat.columbia.edu/2018/03/15/need16 $\endgroup$
    – Erik Ruzek
    Feb 12 at 23:03
  • $\begingroup$ @Erik Ruzek The moderators are at the subject level (personality traits) and I'm mostly interested in the interaction between the moderators and condition. I would expect a moderate correlation between the moderators and the dependent variable. I would not necessarily expect a main effect of the condition (although there might be one). I've looked at the simulation options, but it seems nearly impossible to do without pilot data. Without data, I have to guess so many input parameters that I'm not convinced so far this will give me a more precise estimate than using rules of thumb ... $\endgroup$
    – strubadur
    Feb 14 at 13:23
  • $\begingroup$ This is the point of power analysis. Fix a certain set of parameters and vary two to three others. Then you run simulations to see what percentage of runs give you a "significant" parameter estimate. If you really have no idea (nothing in the literature to help you?), then you should probably run a pilot study and base your simulation on the results of the pilot study. Just know that because your moderators are at the subject level, that the subject sample size is the most important factor. E.g., ncbi.nlm.nih.gov/pmc/articles/PMC2678722 and $\endgroup$
    – Erik Ruzek
    Feb 14 at 13:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.