Mixed-model power analysis - MCPower app
Mixed models add random effects for clustered or repeated-measures data — observations grouped within schools, clinics, subjects, and so on. Top to bottom:
1. Formula with a random effect
Write the fixed part as in regression, then add a grouping term in parentheses — a random intercept for cluster is (1 | cluster), e.g. y = x1 + x2 + (1 | cluster). Fixed-effect operators match regression: : is the interaction term on its own and * expands to a + b + a:b. See formula syntax and mixed effects.
2. Outcome type — Linear, Logit, Probit, or Poisson
The Outcome type dropdown at the top of the Model section switches the mixed model's family — the same four choices as plain regression, see supported families. Linear (the default) is a Gaussian linear mixed model; Logit and Probit are a clustered GLMM for a binary outcome (a logistic or probit regression with a cluster-level random intercept); Poisson is a clustered GLMM for a count outcome.
Under Logit or Probit a baseline probability input appears — the event probability when every predictor sits at its reference level, which fixes the model intercept. Predictor effects are then read on the log-odds (Logit) or probit scale; see logistic effect sizes for what a log-odds beta means in probability terms. Under Poisson a baseline rate input appears instead — the expected count at the reference level — and effects read as log-rate shifts. Switching back to Linear restores the Gaussian fit.
The other three families size their random intercept with an ICC (0–1). Poisson has no natural latent-scale ICC, so its cluster panel asks for τ² (tau-squared) — the random intercept's raw variance — instead. See clustered counts and probits.
3. Cluster configuration
The grouping term unlocks the cluster panel: the cluster name (mirrored from the (1 | …) term), the ICC — the between-cluster variance share in [0, 1); a higher ICC makes within-cluster observations more alike, lowering the effective sample size — and the number of clusters (or cluster size; fix one and the other follows from n).
For a repeated-measures design the cluster is the participant and the sample size counts measurements — N = participants × trials-per-participant. Sixty participants on 100 trials each is n = 6000 with number of clusters = 60, not n = 60. See Repeated measures.
Which of the two fields you fix also decides what Find sample size can search in — see step 7 below.
4. Predictors
Each fixed-effect predictor is one card: pick its type next to the name (continuous, binary, or factor), then set its standardised effect size in the same card — continuous 0.10 / 0.25 / 0.40, binary or factor 0.20 / 0.50 / 0.80. See variable types and effect sizes.
5. Sensitivity analysis (scenarios)
The Sensitivity analysis toggle in the status bar repeats every run under three perturbation sets — Optimistic (your exact settings, no perturbations), Realistic (moderate assumption violations), and Doomer (severe violations, a worst case) — so you get a range of power instead of one optimistic number. Mixed models additionally perturb the random effect (its distribution, df, and ICC noise). If even Doomer clears your target, the design is robust; if only Optimistic reaches it, increase the sample size. Each set's knobs are editable under Settings → Scenarios. See sensitivity analysis.
6. Optional settings
The Advanced section exposes the number of simulations (mixed models default to 800, since each fit is heavier), α (0.05), seed (2137), and the failed-simulation tolerance.
For a clustered Logit, Probit, or Poisson model, Advanced also shows the estimation-mode switch — Fast, Accurate, or AGQ — see estimation mode for what each does and when AGQ is available.
7. Find sample size in cluster units
Find sample size sweeps a from/to grid of n and reads the required sample size off the fitted power curve. For a mixed model that grid does not have to be in observations — the card carries two unit chips on their own row under the from/to/step inputs, labelled search in.
- In the cluster panel (step 3), fix the field you are not searching for. Fix the number of clusters to search cluster size; fix the cluster size to search the number of clusters.
- Open the Find sample size card. The chip row now offers observations plus one cluster chip — cluster size when the cluster number is fixed, cluster number when the cluster size is fixed. Only the one your fixed field allows is offered.
- Pick the cluster chip and type the from/to/step range in that unit — a range in participants, or in trials per participant, not in measurements.
- Read the echo line under the row: it restates the same range in the other unit, so you can see the total N a "20 to 80 sites" search actually sweeps without converting by hand.
- Run. The result reports both numbers, the unit value and the raw N behind it.
Going back to the cluster panel and switching which field is fixed resets the chip to observations — the old cluster unit no longer has a divisor, so the range would be meaningless. Reselect the chip after the switch.
Which unit to search is a design question, not a display preference: a predictor assigned at the cluster level (a treatment randomised per site) gains power from more clusters and little from bigger ones, while a predictor that varies within the cluster gains from both. See Search in cluster units and Cluster-level predictors.