Tutorials › Model-Informed Drug Development (MIDD) › Planning Sample Size for Repeated-Measures Endpoints

Case Studies: Questions, Evidence and Decisions · Tutorial 554 of 596

Planning Sample Size for Repeated-Measures Endpoints

Build and stress-test a repeated-measures trial design by linking its visit schedule and covariance assumptions to treatment-contrast power and precision.

Advanced 12 min read

What You'll Learn

  • Define the treatment contrast as an average effect across scheduled visits.
  • Calculate how within-subject correlation and visit count affect the variance of that contrast.
  • Use simulation to estimate power across candidate sample sizes.
  • Translate the same design assumptions into confidence-interval precision.
  • Diagnose when dropout, covariance misspecification, or treatment-effect variation makes a plan unreliable.
  • Compare simulation with a closed-form approximation and explain when each is useful.

Why Sample Size Depends on the Repeated-Measures Design

For a repeated-measures endpoint, the sample size cannot be planned from the number of observations alone. Several measurements from one participant are related, so four visits do not provide the same information as four independent participants. The benefit of additional visits depends on the within-participant covariance, the contrast the trial is designed to estimate, and whether the assumed trajectory is plausible.

This tutorial develops a concrete design case in which the primary treatment contrast is the average difference between treatment groups across scheduled post-baseline visits. The goal is to use a specified outcome model to simulate trial data under candidate designs, fit the planned analysis, and estimate both power and precision. The result is conditional on the assumptions supplied to the simulation; it is not a guarantee of a future trial's outcome.

Definition: Power is the probability that the planned test rejects \(H_0\) under a specified alternative and the assumed data-generating model. Precision describes the uncertainty of the estimated treatment contrast, commonly summarized by its standard error or confidence-interval width. A sample-size plan should state the contrast, significance level, target effect, covariance assumptions, visit schedule, and target power or precision.

Specify the Estimand and a Planning Model

Let \(Y_{ij}\) be participant \(i\)'s endpoint at post-baseline visit \(j\), with \(m\) scheduled visits. For this design case, define the participant's endpoint summary as the arithmetic average across those visits. The treatment contrast \(\Delta\) is the difference between treatment-group means of that summary. Thus, if the treatment effect is constant across visits, \(\Delta\) is also the common treatment difference at each visit. This definition makes the visit schedule part of the estimand: changing which visits are included changes the average being targeted.

Assume equal allocation, \(n\) participants per group, complete measurements at all \(m\) visits, and a common covariance structure in both groups. For planning, suppose the visit outcomes are multivariate normal with marginal standard deviation \(\sigma\) and exchangeable correlation \(\rho\): every pair of distinct visits has the same correlation. The model allows visit means to change over time, but assumes the treatment difference is constant across visits. Under these assumptions, a comparison of participant-level visit averages is a valid analysis of the defined contrast. The two-sample \(t\)-test uses \(df=2n-2\).

$$ \operatorname{Var}(\bar{Y}_i) =\frac{\sigma^2}{m}\left[1+(m-1)\rho\right], \qquad SE(\hat{\Delta}) =\sqrt{\frac{2\sigma^2[1+(m-1)\rho]}{mn}}. $$

The first expression is the variance of one participant's average. It follows by adding the \(m\) marginal variances and the \(m(m-1)\) ordered covariance terms, then dividing by \(m^2\). The second expression follows because the treatment contrast subtracts independent group means, each based on \(n\) participants. These formulas show why extra visits help less when visits are highly correlated.

Planning assumptions: The formulas above require complete measurements, equal group sizes, a common marginal variance and correlation pattern, independent participants, and the stated visit-average contrast. The \(t\)-test also relies on the participant averages being normally distributed, or on a sample size large enough for its approximation to be adequate. If the treatment effect changes over visits, a constant-effect model does not answer a visit-specific treatment question.

From Variance to a Candidate Sample Size

For a two-sided test at significance level \(\alpha\), power depends on the assumed treatment contrast \(\Delta\) relative to its standard error. With the \(t\)-test, the test statistic follows a noncentral \(t\) distribution under the planning alternative, with \(df=2n-2\) and noncentrality parameter \(\lambda=\Delta/SE(\hat{\Delta})\). The sample size can be found by evaluating this power over candidate values of \(n\). A useful initial approximation replaces the \(t\) critical value with a normal critical value:

$$ n \approx \frac{2\sigma^2[1+(m-1)\rho]}{m\Delta^2} \left(z_{1-\alpha/2}+z_{1-\beta}\right)^2, $$

where \(1-\beta\) is the target power and \(z_q\) is the \(q\)-quantile of the standard normal distribution. Round the result up, then evaluate the actual planned test at that integer sample size. The approximation is a starting point, not a substitute for checking power under the analysis that will be used.

Worked Example: A First Sample-Size Calculation

Suppose a hypothetical trial measures a continuous symptom score at four post-baseline visits. Planning values are \(\sigma=10\) points, \(\rho=0.50\), and a target average treatment difference \(\Delta=4\) points. The design uses a two-sided \(\alpha=0.05\) test and targets 90% power.

First calculate the variance of a participant's four-visit average:

$$ \operatorname{Var}(\bar{Y}_i) =\frac{10^2[1+(4-1)(0.50)]}{4} =\frac{100(2.5)}{4} =62.5\ \text{points}^2. $$

Using \(z_{0.975}=1.960\) and \(z_{0.90}=1.282\), the approximate sample size per group is:

$$ n \approx \frac{2(62.5)}{4^2}(1.960+1.282)^2 =\frac{125}{16}(3.242)^2 \approx 82.1. $$

Rounding up gives 83 participants per group, or 166 in total, before any allowance for dropout. The approximate standard error at that sample size is \(\sqrt{125/83}=1.227\) points. A 95% interval has an approximate half-width of \(1.96(1.227)=2.40\) points. This is a planning approximation; the final power and interval calculation should use the chosen analysis and degrees of freedom.

Use Simulation to Compare Designs

A simulation evaluates the entire design-and-analysis process rather than relying only on an approximate formula. For every replicate, generate a participant's vector of repeated outcomes from the assumed multivariate distribution, assign the specified treatment effect, apply the trial's analysis, and record whether the \(H_0:\Delta=0\) test rejects at \(\alpha=0.05\). The estimated power is the proportion of simulated trials that reject. Repeating this for several sample sizes shows how much enrollment is needed under the stated assumptions.

For the four-visit case, the covariance matrix has diagonal entries \(100\) and off-diagonal entries \(50\), since the variance is \(10^2\) and the covariance is \(\rho\sigma^2=0.50(100)\). The treatment group has a mean four points lower at each visit than the control group; the control visit means may vary over time, but their exact values do not affect the variance of the contrast in this constant-effect setup.

Worked Example: Simulating Power and Precision

Consider the same hypothetical endpoint, covariance, and \(\Delta=4\)-point alternative. For each candidate \(n\), simulate 10,000 trials with four complete visits per participant. In every trial, calculate each participant's four-visit average and apply the two-sided pooled \(t\)-test to the group averages. The following illustrative results are consistent with the planning calculations:

Participants per groupApproximate SE (points)Illustrative simulated power
501.5810.716
701.3360.846
831.2270.900

For \(n=70\), for example, the standard error is \(\sqrt{125/70}=1.336\) points. The noncentrality parameter is \(4/1.336=2.994\), giving power of about 0.85 for the two-sided test. The simulation estimate, 0.846, is close to that value. At \(n=83\), the estimated power meets the 90% target in this illustrative run. With 10,000 replicates and power near 0.90, the Monte Carlo standard error is approximately \(\sqrt{0.9(0.1)/10000}=0.0030\); simulation noise alone can therefore shift the estimate by a few tenths of a percentage point.

Precision can be examined in the same replicates by recording the fitted treatment contrast and its confidence interval. At \(n=83\), the expected 95% interval half-width is about \(2.4\) points, or a full width near \(4.8\) points. This is not a promised width for each realized trial: observed standard errors vary from trial to trial. Power and precision answer different questions, so both should be checked against the design objective.

Visit Schedules and Covariance Assumptions

The next example changes the number of visits and the within-participant correlation while holding the marginal standard deviation and target contrast fixed. This isolates how assumptions about repeated observations affect the planned enrollment. The calculations use the same normal approximation for 90% power, so they are comparisons of planning scenarios rather than final sample-size recommendations.

Worked Example: Stress-Testing Visit Count and Correlation

Keep \(\sigma=10\), \(\Delta=4\), and \(\alpha=0.05\). With four visits and \(\rho=0.20\), the variance of a participant average is:

$$ \frac{100[1+3(0.20)]}{4}=40.0\ \text{points}^2. $$

The approximate 90%-power sample size is \(n\approx 2(40.0)(3.242)^2/16=52.6\), so round up to 53 per group. Under the base assumption \(\rho=0.50\), the corresponding value is about 82.1, requiring 83 per group. If \(\rho=0.70\), the participant-average variance is \(100[1+3(0.70)]/4=77.5\), and the required sample size is \(2(77.5)(3.242)^2/16=101.7\), or 102 per group.

Visit count also matters, but with diminishing returns. At \(\rho=0.50\), three visits give variance \(100[1+2(0.50)]/3=66.7\) points squared, corresponding to about 88 participants per group. Six visits give variance \(100[1+5(0.50)]/6=58.3\) points squared, corresponding to about 77 per group. The gain from three to six visits is smaller than the gain from one to three because strongly correlated measurements add limited new information.

These comparisons are meaningful only if the visit-average contrast remains appropriate and each schedule's visits can be collected as assumed. A larger number of visits may increase participant burden, missed visits, or dropout. Those consequences can offset the nominal precision gain and should be represented in a more realistic simulation if material.

Justification and Practical Simulation Workflow

The variance result follows directly from the covariance structure. Let \(Y_{i1},\ldots,Y_{im}\) have variance \(\sigma^2\) and pairwise covariance \(\rho\sigma^2\). Since \(\bar{Y}_i=m^{-1}\sum_{j=1}^{m}Y_{ij}\), the variance of a sum is the sum of all variances and covariances:

$$ \begin{aligned} \operatorname{Var}(\bar{Y}_i) &=\frac{1}{m^2}\left[m\sigma^2+m(m-1)\rho\sigma^2\right]\\ &=\frac{\sigma^2}{m}\left[1+(m-1)\rho\right]. \end{aligned} $$

The term \(m(m-1)\) counts ordered pairs of distinct visits. For independent visits, \(\rho=0\), the variance falls to \(\sigma^2/m\). As \(\rho\) approaches one, the visits provide nearly redundant information, and the variance approaches \(\sigma^2\). This derivation explains both the benefit of added visits and its dependence on covariance.

A defensible simulation plan proceeds in a fixed sequence:

1
Fix the target.
State the endpoint, visit-average contrast, target treatment difference, two-sided significance level, and desired power or interval width.
2
Specify plausible data generation.
Choose visit means, marginal variability, covariance, allocation, and a treatment-effect pattern. Include missing-data and dropout mechanisms if they are expected to affect the analysis.
3
Apply the planned analysis.
Fit the same analysis intended for the trial, including its handling of incomplete records and its definition of the treatment contrast.
4
Summarize operating characteristics.
Across replicates, estimate power, bias, standard error, confidence-interval coverage, and interval width. Repeat across sample sizes and credible assumptions.

Diagnostics, Alternatives, and Limitations

A simulated result is only as credible as the model and analysis used to produce it. Check that the covariance matrix is mathematically valid, that simulated variances and correlations match the inputs, and that the fitted analysis targets the intended contrast. Under the null, verify that the estimated type I error is near \(\alpha\); under alternatives, check bias and confidence-interval coverage as well as rejection probability. Increase the number of replicates when Monte Carlo uncertainty is large relative to the decision threshold.

The exchangeable model is deliberately simple. Actual longitudinal data may have correlations that decline with the time separating visits, unequal variances across visits, or treatment effects that grow or diminish over time. The primary analysis may also use all visit-level data in a mixed model rather than reduce each participant to an average. In those settings, simulate from and fit the proposed longitudinal model, and define the contrast explicitly. Do not use the visit-average formula as though it automatically represented a time-specific contrast or an analysis with a different covariance structure.

A closed-form calculation is fast and useful for screening candidate designs when assumptions are simple and balanced. Simulation is more flexible: it can reproduce the intended estimation procedure and examine irregular visit schedules, missingness, unequal allocation, or more complex covariance patterns. The trade-off is that simulation requires more assumptions and can conceal errors if the data-generating and analysis steps are not checked. An analytic result is not inherently safer if its assumptions are implausible; a simulation is not inherently realistic merely because it is detailed.

Important failure modes include planning from an optimistic correlation estimate, treating repeated observations as independent, selecting a treatment difference without clinical justification, and ignoring loss of information from incomplete visits. If the true correlation is higher than planned, power may be lower than expected; if treatment effects differ across visits, the average contrast may obscure a meaningful time pattern. Sensitivity analyses should therefore vary the assumptions most likely to change the decision, particularly the covariance, treatment-effect size, visit schedule, and missing-data process.

Common pitfall: “There are four visits, so four measurements provide four times as much information as one.” This treats measurements on the same participant as independent. With \(\rho=0.50\) and four visits, the average's variance is \(62.5\) points squared, not \(100/4=25\). The correct calculation includes the covariance terms; more visits can improve precision, but the gain depends on their correlation.

Check Your Understanding

Answer each question using the planning model described above. Brief solutions follow the questions.

  1. With \(\sigma=8\), \(m=3\), and \(\rho=0.40\), calculate the variance of one participant's visit average.
  2. For the conditions in Question 1, suppose \(n=64\) per group. Calculate the standard error of the treatment contrast.
  3. What happens to the variance of a participant average as \(\rho\) approaches one, and why?
  4. Name two checks, other than power, that should be made in a simulation of a planned repeated-measures analysis.
  5. Why might a design with more scheduled visits fail to achieve its predicted precision in practice?

Solutions: (1) \(\operatorname{Var}(\bar{Y}_i)=64[1+2(0.40)]/3=38.4\) units squared. (2) \(SE=\sqrt{2(38.4)/64}=\sqrt{1.2}=1.095\) units. (3) The variance approaches \(\sigma^2\), because highly correlated visits provide nearly redundant measurements rather than independent information. (4) Suitable checks include type I error under \(H_0\), bias, confidence-interval coverage, and agreement between simulated and specified covariance. (5) Additional visits can increase burden and missingness; the nominal precision calculation assumes the visits and covariance pattern used in planning are realized.