Tutorials › Group Sequential Methods and Sample Size Re-Estimation › Masked Covariance Estimation For Repeated-Measures Outcomes

Blinded Re-Estimation · Tutorial 383 of 699

Masked Covariance Estimation For Repeated-Measures Outcomes

Estimate covariance from masked repeated outcomes, assess when pooling is reliable, and translate the planned contrast’s covariance into a sample-size calculation.

Intermediate 12 min read

What You'll Learn

  • Define the within-participant covariance matrix for repeated outcomes.
  • Calculate a pooled covariance estimate from participant-level measurements.
  • Explain how treatment mean differences can contaminate a masked covariance estimate.
  • Compute the variance of a planned contrast using its visit weights and covariance matrix.
  • Use that contrast variance to calculate and interpret a two-group sample-size requirement.
  • Recognize when structured covariance assumptions or diagnostics may be needed.

Why covariance matters in a blinded re-estimation

When each participant is measured at multiple visits, the observations from the same participant are generally related. Planning a comparison based on a change score, an average across visits, or another linear contrast therefore requires more than the separate variance at each visit: it requires the covariances among visits. Those covariances determine the variability of the planned contrast, and hence the sample size needed to detect a specified effect.

In a blinded re-estimation, treatment assignments are not used to form the nuisance estimate. A simple pooled covariance matrix can be calculated from all participants’ repeated outcomes without treatment labels. This is useful, but pooling has a key limitation: if treatment groups have different mean outcome profiles, the pooled covariance includes a component from those differences. The resulting estimate is not automatically the within-treatment covariance needed for planning.

Definition: Let \(Y_i=(Y_{i1},\ldots,Y_{im})^\mathsf{T}\) be participant \(i\)’s outcomes at \(m\) planned visits. The within-participant covariance matrix \(\Sigma\) has entry \(\Sigma_{jk}=\operatorname{Cov}(Y_{ij},Y_{ik})\). Its diagonal entries are visit-specific variances; its off-diagonal entries are covariances between visits. For a planned contrast with fixed weights \(w=(w_1,\ldots,w_m)^\mathsf{T}\), the participant-level contrast is \(C_i=w^\mathsf{T}Y_i\), and its variance is \(w^\mathsf{T}\Sigma w\).

Pooled covariance estimation and its assumptions

Suppose there are \(N\) participants with complete measurements at the same \(m\) visits. Let \(\bar{Y}\) be the vector of pooled sample means, calculated separately at each visit. The usual pooled sample covariance matrix is

$$ S_{\text{pool}}=\frac{1}{N-1}\sum_{i=1}^{N}(Y_i-\bar{Y})(Y_i-\bar{Y})^\mathsf{T}. $$

This calculation uses participant-level vectors, not separate visit-specific data sets. Each diagonal entry is a sample variance, and each off-diagonal entry is the corresponding sample covariance. The estimator targets a common within-group covariance matrix when participants are independent, the visit measurements are comparably defined, and the groups have the same covariance structure. For the straightforward blinded interpretation, it also requires that differences between group mean profiles are negligible or absent. Complete measurements at the included visits are assumed for the formula as written.

The last condition matters because pooled centering subtracts the overall visit means, not the separate means in each treatment group. To see the consequence, suppose there are two groups with fixed mean vectors \(\mu_0\) and \(\mu_1\), a common within-group covariance \(\Sigma\), and \(n_0\) and \(n_1\) participants. Write \(\delta=\mu_1-\mu_0\). The pooled sample covariance has an expected within-group contribution \(\Sigma\), plus a between-group contribution:

$$ E(S_{\text{pool}})=\Sigma+ \frac{n_0n_1}{N(N-1)}\delta\delta^\mathsf{T}, \qquad N=n_0+n_1. $$

The multiplier is nonnegative, and \(\delta\delta^\mathsf{T}\) adds variation in directions where the group mean profiles differ. For large \(N\), the multiplier is approximately \(\pi_0\pi_1\), where \(\pi_g=n_g/N\). Thus, with balanced groups, the approximate added term is \(\delta\delta^\mathsf{T}/4\). Masking does not make this term disappear: it prevents the analyst from subtracting separate group means.

Worked Example: Calculating a Pooled Two-Visit Covariance

Consider four hypothetical participants measured at baseline and follow-up. Their outcomes, in points, are \((10,14)\), \((12,15)\), \((8,11)\), and \((10,12)\). Suppose the treatment labels are masked and the pooled calculation is used.

The pooled visit means are \(\bar{Y}_1=(10+12+8+10)/4=10\) points and \(\bar{Y}_2=(14+15+11+12)/4=13\) points. The centered vectors are \((0,1)\), \((2,2)\), \((-2,-2)\), and \((0,-1)\). The sums of squared centered deviations are \(8\) at baseline and \(10\) at follow-up; the sum of cross-products is \(8\). Dividing each by \(N-1=3\) gives

$$ S_{\text{pool}}= \begin{pmatrix} 8/3 & 8/3\\ 8/3 & 10/3 \end{pmatrix} = \begin{pmatrix} 2.667 & 2.667\\ 2.667 & 3.333 \end{pmatrix} \text{ points}^2. $$

For example, the estimated baseline–follow-up covariance is \(2.667\) points squared, not \(2.667\) points. With only four participants this is a highly uncertain estimate; the calculation illustrates the estimator, not a recommendation that such a small interim sample is adequate.

From the covariance matrix to the planned contrast

A contrast is a weighted sum of visit outcomes. Its variance follows directly from the covariance matrix. In a two-visit change score, for example, \(w=(-1,1)^\mathsf{T}\), so the participant’s score is follow-up minus baseline. Expanding the matrix product gives

$$ \operatorname{Var}(C_i)=w^\mathsf{T}\Sigma w =\sigma_1^2+\sigma_2^2-2\sigma_{12}. $$

The sign of the covariance term depends on the contrast weights. Positive covariance reduces the variance of a difference between visits, because participants with above-average baseline outcomes tend also to have above-average follow-up outcomes. For a weighted average with weights of the same sign, positive covariance instead contributes positively to the variance.

For a two-group comparison with independent participants, common contrast variance \(\sigma_C^2=w^\mathsf{T}\Sigma w\), and \(n_0,n_1\) participants per group, the variance of the difference in mean contrasts is \(\sigma_C^2(1/n_0+1/n_1)\). Under equal allocation with \(n\) participants per group, the usual normal-approximation planning formula for a two-sided test is

$$ n=\frac{2\sigma_C^2(z_{1-\alpha/2}+z_{1-\beta})^2}{\Delta_C^2}, $$

where \(\Delta_C\) is the target between-group difference in the planned contrast, \(\alpha\) is the Type I error rate, and \(1-\beta\) is the target power. This calculation assumes the specified contrast and effect are appropriate, the common variance is a reasonable planning value, observations are independent across participants, and the normal approximation is suitable. In practice, the calculated value is rounded up to a whole participant per group.

Worked Example: Sample Size for a Change Contrast

Suppose a hypothetical trial plans to compare the mean change from baseline to follow-up between two equally sized groups. A blinded covariance estimate gives baseline variance \(64\) points squared, follow-up variance \(100\) points squared, and covariance \(48\) points squared. The target between-group difference in mean change is \(5\) points. Use a two-sided \(\alpha=0.05\) and 80% power, with \(z_{0.975}=1.960\) and \(z_{0.80}=0.8416\).

For \(w=(-1,1)^\mathsf{T}\), the estimated variance of an individual’s change is

$$ \hat{\sigma}_C^2=64+100-2(48)=68\text{ points}^2. $$

Substitute this variance and the design values into the equal-allocation formula:

$$ n=\frac{2(68)(1.960+0.8416)^2}{5^2} =\frac{136(7.84896256)}{25} =\frac{1067.45890816}{25} \approx 42.6984. $$

Rounding up gives 43 participants per group, or 86 in total, before any allowance for missing outcomes. As a comparison, ignoring covariance would use \(64+100=164\) points squared as the change variance, yielding \(n=2(164)(7.84896256)/25\approx102.98\), or 103 per group. That much larger value follows from the deliberately different assumption of zero covariance; it is not the estimate supported by the stated covariance matrix.

Why masking can change the contrast variance estimate

The pooled covariance estimate can be inserted into the contrast formula, but the group-mean contribution also projects onto that contrast. Applying \(w\) to the pooled covariance decomposition gives

$$ w^\mathsf{T}E(S_{\text{pool}})w =w^\mathsf{T}\Sigma w+ \frac{n_0n_1}{N(N-1)}(w^\mathsf{T}\delta)^2. $$

This shows precisely which part of the group mean difference affects the planned contrast variance estimate: it is the squared difference between groups on that contrast. A pooled matrix may be contaminated in some directions but not others. If \(w^\mathsf{T}\delta=0\), this between-group component does not inflate the variance estimate for that particular contrast, even though other entries of the matrix may be affected. In general, however, the contrast-specific contamination cannot be assessed from pooled data alone because the group labels and the contrast difference are masked.

Worked Example: Mean-Profile Contamination of a Change Variance

Consider a separate hypothetical balanced trial with two visits, common within-group covariance \(\Sigma=\begin{pmatrix}64&48\\48&100\end{pmatrix}\) points squared, and a treatment-minus-control mean profile \(\delta=(0,4)^\mathsf{T}\) points at an interim analysis. For the change contrast \(w=(-1,1)^\mathsf{T}\), the true within-group change variance is \(68\) points squared, as calculated from \(\Sigma\).

With equal group sizes, the large-sample pooled covariance contribution from the group means is approximately \(\delta\delta^\mathsf{T}/4\). Its contribution to the change variance is

$$ \frac{1}{4}(w^\mathsf{T}\delta)^2 =\frac{1}{4}((-1)(0)+(1)(4))^2 =4\text{ points}^2. $$

Thus, the approximate pooled change-variance estimate is \(68+4=72\) points squared. Using 72 rather than 68 in the preceding sample-size setting gives

$$ n=\frac{2(72)(7.84896256)}{25} =\frac{1130.2506}{25} \approx45.2100, $$

or 46 participants per group after rounding up. This calculation isolates the direction and size of the contamination; it does not claim that the masked analyst can identify the mean profile \(\delta\) in practice.

Derivation, diagnostics, and alternatives

The covariance decomposition follows by centering within each group. Let \(\bar{Y}_g\) be the sample mean in group \(g\); then $$ \sum_{i=1}^{N}(Y_i-\bar{Y})(Y_i-\bar{Y})^\mathsf{T} =\sum_{g=0}^{1}\sum_{i\in g}(Y_i-\bar{Y}_g)(Y_i-\bar{Y}_g)^\mathsf{T} +\sum_{g=0}^{1}n_g(\bar{Y}_g-\bar{Y})(\bar{Y}_g-\bar{Y})^\mathsf{T}. $$ The cross-products vanish exactly because the within-group deviations sum to zero in each group. For two independent groups with common covariance \(\Sigma\), the expected within-group scatter is \((N-2)\Sigma\), and the expected between-group scatter is \(\Sigma+(n_0n_1/N)\delta\delta^\mathsf{T}\); dividing their sum by \(N-1\) gives the stated expression.

Before using a pooled estimate, check the data and the design against its assumptions. Confirm that each row corresponds to one participant and columns correspond to the intended visits, that units and visit definitions are consistent, and that the matrix is symmetric. A covariance matrix should also be positive semidefinite; a computed matrix with a materially negative eigenvalue can indicate data-processing or numerical problems. Inspect visit-specific variances, correlations, scatterplots, and the number of participants contributing at each visit. Strongly changing variances, unusual patterns over time, or substantial incomplete measurements warn that a single common covariance estimate may not represent the planned analysis.

A central diagnostic limitation is that treatment masking hides the very group mean profiles needed to assess the between-group term. A large pooled covariance or a change in its entries can therefore reflect a true change in within-participant variability, a treatment mean-profile difference, or both. The pooled estimate alone cannot distinguish these explanations. Prespecifying which visits, contrast, covariance estimator, and assumptions will be used helps keep the nuisance update interpretable.

An unstructured covariance estimate allows each variance and covariance to differ, but requires enough participants to estimate its many entries reliably. Structured alternatives impose simpler patterns: compound symmetry uses a common variance and common within-person correlation, while an autoregressive structure makes correlations decline with visit separation. Such structures can stabilize estimation when justified by the measurement schedule and scientific setting, but a convenient structure should not be assumed solely because the unstructured estimate is noisy. Independence is another possible planning assumption; it sets off-diagonal covariances to zero and can badly misstate the contrast variance when repeated outcomes are correlated.

Common pitfall: It is incorrect to claim that masking automatically protects a pooled covariance estimate from treatment effects. The pooled sample covariance includes between-group mean-profile variation when those profiles differ. The correction is to state the equal-mean-profile assumption, quantify the potential impact when defensible information is available, and acknowledge that treatment labels are needed to separate within-group covariance from that contribution.

The method’s main limitation is identifiability: without treatment labels or additional modeling assumptions, pooled repeated outcomes generally do not identify the within-group covariance matrix separately from treatment mean differences. It is most straightforward when treatment mean differences are negligible for covariance-estimation purposes, or when the planning procedure explicitly accepts the pooled estimate as an approximation. An alternative is a model-based covariance estimate that uses treatment assignments, if unmasking is permitted and the design’s statistical safeguards allow it. Another alternative is to prespecify a defensible structured covariance model. These approaches trade masking, modeling assumptions, and precision differently; none makes the underlying assumptions irrelevant.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. For a two-visit difference \(C=Y_2-Y_1\), write its variance in terms of the visit variances and covariance.
  2. A planned contrast has weights \(w=(1/2,1/2)^\mathsf{T}\). Describe how positive covariance affects its variance compared with the case of zero covariance.
  3. With balanced groups, an interim mean-profile difference is \(\delta=(2,0)^\mathsf{T}\). For the contrast \(w=(-1,1)^\mathsf{T}\), what is the approximate between-group contribution to the pooled contrast variance?
  4. Why can a pooled covariance matrix not generally be interpreted as an estimate of within-group covariance when treatment labels are masked?
  5. A change-score variance estimate is \(50\) points squared. What happens to the planned sample size if the target effect and design error rates remain fixed but the variance estimate increases?

Solutions. (1) \(\operatorname{Var}(Y_2-Y_1)=\sigma_1^2+\sigma_2^2-2\sigma_{12}\). (2) Positive covariance adds \(2(1/2)(1/2)\sigma_{12}=\sigma_{12}/2\) to the variance of the average, so it increases that variance relative to zero covariance. (3) \(w^\mathsf{T}\delta=(-1)(2)+(1)(0)=-2\); the balanced-group contribution is approximately \((-2)^2/4=1\) outcome-unit squared. (4) Pooling centers at the overall visit means, so differing group mean profiles add a between-group component to the covariance. (5) The required sample size is proportional to the contrast variance when the effect and error rates are fixed, so an increased variance increases the required sample size.

Clinical Biostats