Why Build the Matrix?
In a multi-arm trial, each treatment may be compared with the same control group. The resulting treatment-control differences are not independent: each includes the same estimated control mean. A covariance matrix records both the variability of each difference and the covariance between every pair of differences. It is therefore the natural summary when several comparisons must be considered together.
This tutorial constructs the matrix from group sample sizes and variances. It focuses on the unstandardized differences between sample means. The earlier material on covariance of standardized treatment statistics concerns a related scale; here, each matrix entry remains in squared outcome units.
Model and Notation
For the formulas below, observations are independent within each group, have finite variances, and are independent across groups. Within group \(g\), observations share variance \(\sigma_g^2\), so \(\operatorname{Var}(\bar X_g)=\sigma_g^2/n_g\). Normal outcomes are not required for these covariance calculations. If the group variances are unknown, the corresponding sample variances \(s_g^2\) provide plug-in estimates.
The assumptions matter. If observations are clustered, repeated, or otherwise dependent, the variance of a group mean may not be \(\sigma_g^2/n_g\). If groups share additional sources of dependence, the cross-group covariance terms may not be zero. In those situations, the simple construction below needs to be replaced by one that represents the actual sampling structure.
Deriving the Matrix Entries
For a single treatment, the treatment and control sample means are independent under the stated model. Thus the variance of their difference is the sum of their variances. For two distinct treatments, expand the covariance of their differences. Independence across groups makes the terms involving treatment means vanish; the control mean appears in both differences and contributes its variance.
The diagonal entries are therefore not obtained by applying the off-diagonal formula to \(i=j\). A diagonal entry is a variance and includes both the treatment-mean variance and the control-mean variance. Every off-diagonal entry is the shared-control contribution alone.
When the variances are unknown, estimate the entries by substituting the group sample variances:
This is a plug-in covariance estimate, not a claim that the unknown population covariance matrix has been observed exactly. The treatment-specific sample variance contributes to its own diagonal; it does not enter the off-diagonal entries under this independent-groups model.
Worked Example: Three Treatments With Known Group Variances
Suppose a hypothetical continuous outcome is measured in four independent groups. The control has \(n_0=40\) and variance \(\sigma_0^2=81\). Treatments 1, 2, and 3 have sample sizes \(30,35,25\) and variances \(100,144,121\), respectively. Construct the covariance matrix of \(D_1,D_2,D_3\), in that order.
The shared-control contribution is \(81/40=2.025\). The treatment-specific contributions to the diagonal entries are \(100/30=3.333\), \(144/35=4.114\), and \(121/25=4.840\). Therefore the diagonal entries are \(3.333+2.025=5.358\), \(4.114+2.025=6.139\), and \(4.840+2.025=6.865\). Each off-diagonal entry is \(2.025\).
The entries are in squared outcome units. For example, the variance of the first treatment-control difference is \(5.358\) outcome-units squared. Its covariance with the second difference is \(2.025\) outcome-units squared, arising from the control mean used in both contrasts.
Using Sample Variances in Practice
In most analyses the population variances are unknown. The same structure applies, but \(s_g^2\) replaces \(\sigma_g^2\). Group sample sizes and sample variances are sufficient to calculate this plug-in matrix under the independent-groups assumptions; the observed group means are not needed for these covariance entries.
Worked Example: A Plug-In Matrix From Summary Data
Consider hypothetical group summaries for an outcome measured in millimetres: the control has \(n_0=24\) and \(s_0=12\) mm. Treatment 1 has \(n_1=20\) and \(s_1=10\) mm; treatment 2 has \(n_2=30\) and \(s_2=15\) mm; treatment 3 has \(n_3=18\) and \(s_3=9\) mm. Assume independent groups and use the observed variances as estimates.
The estimated shared-control contribution is \(s_0^2/n_0=12^2/24=144/24=6\) mm\(^2\). For treatment 1 the diagonal estimate is \(10^2/20+6=5+6=11\) mm\(^2\). For treatment 2 it is \(15^2/30+6=7.5+6=13.5\) mm\(^2\). For treatment 3 it is \(9^2/18+6=4.5+6=10.5\) mm\(^2\).
For instance, the estimated variance of the treatment 2 minus control mean difference is \(13.5\) mm\(^2\). The estimated covariance of the treatment 1 and treatment 3 differences is \(6\) mm\(^2\). This calculation estimates sampling variability under the model; it does not estimate the treatment effects themselves.
Checking the Construction
A useful way to avoid entry-by-entry errors is to calculate the common control term once, then add it to each treatment-specific mean variance for the diagonal. Keep the row and column order fixed and label it explicitly. Changing the order of contrasts requires changing the row and column order in the same way.
Write the treatment labels in a fixed order; each row and column will follow that order.
Use \(\sigma_g^2/n_g\) when population variances are specified, or \(s_g^2/n_g\) for a plug-in estimate.
For treatment \(i\), add its mean variance to the control mean variance.
For each distinct pair of treatments, enter the control mean variance.
All entries must be in squared outcome units, and the entry in row \(i\), column \(j\) must equal the entry in row \(j\), column \(i\).
Symmetry is an immediate arithmetic check, but it does not by itself verify that the sampling assumptions are appropriate. Check how participants were assigned and whether the analysis has additional dependence, such as repeated measurements or clustering. Also check whether the supplied variances are group-specific or are a common pooled estimate: using a pooled variance imposes a common-variance assumption and should not be done merely for convenience.
Common Mistakes and Alternatives
- Setting off-diagonal entries to zero. This treats the contrasts as if they used independent control estimates. With one shared control mean, each contrast contains \(-\bar X_0\), so the covariance includes \(\operatorname{Var}(\bar X_0)\).
- Putting only the control contribution on the diagonal. A diagonal entry is the variance of a full difference. It must include both the treatment and control mean variances.
- Using the treatment variance in an off-diagonal entry. Under the stated independence assumptions, distinct treatment means contribute no covariance with one another or with the control mean. The shared-control term is the off-diagonal contribution.
- Mixing variances and standard deviations. The formula uses \(\sigma_g^2\) or \(s_g^2\), not \(\sigma_g\) or \(s_g\). For example, with \(s_0=12\) and \(n_0=24\), the term is \(12^2/24=6\), not \(12/24\).
- Ignoring the sampling design. A matrix constructed as if groups were independent may be wrong for paired, clustered, or repeated-measures data. The mean variances and cross-group covariances must reflect that design.
An alternative design uses a separate, independent control group for each treatment. Under independence, that design has no shared-control contribution between different contrasts, unlike the single-control construction here. Another analytical choice is to estimate a common variance by pooling across groups; this can be appropriate under a common-variance model, but it changes the variance estimation and requires that assumption. The group-specific construction above does not require equal variances.
The matrix is useful because it preserves the dependence information that is lost if each contrast is summarized only by its own standard error. Its entries depend on the sampling variances and allocation, not on whether the observed treatment means happen to be similar. The construction is limited to the stated contrast form and sampling structure; more general contrasts or dependence patterns require their own covariance calculations.
Worked Example: Spotting a Missing Diagonal Contribution
A hypothetical study has a control group with \(n_0=16\), \(s_0=8\), and a treatment group with \(n_1=20\), \(s_1=10\), in the same outcome units. An analyst reports the estimated variance of the treatment-control difference as \(s_0^2/n_0=64/16=4\) outcome-units squared. Check the calculation.
The analyst has included only the control contribution. The treatment mean also varies, with estimated variance \(s_1^2/n_1=100/20=5\) outcome-units squared. Under independent groups, the correct estimated variance is \(5+4=9\) outcome-units squared. Thus the reported value understates the plug-in variance by omitting the treatment contribution.
Check Your Understanding
Try each question, then compare your work with the solutions below.
- A control group has \(n_0=25\) and variance \(100\). A treatment group has \(n_1=20\) and variance \(80\). What is the variance of its treatment-control difference?
- Two treatment groups use the control in question 1. What is the covariance of their treatment-control differences under the independent-groups model?
- For three treatments, explain why each off-diagonal entry is the same even when treatment sample sizes and variances differ.
- What changes in the construction when population variances are unknown and sample variances are used?
- Name one design feature that would make the independent-groups construction questionable.
Solutions. 1. The variance is \(80/20+100/25=4+4=8\) outcome-units squared. 2. The covariance is the shared-control mean variance, \(100/25=4\) outcome-units squared. 3. Each distinct pair shares the same control mean, and the treatment means are independent of each other and of the control mean; hence each off-diagonal entry is \(\sigma_0^2/n_0\). 4. Substitute \(s_g^2\) for \(\sigma_g^2\), giving a plug-in estimate of the covariance matrix. 5. Clustering, repeated measurements, or other dependence across groups can invalidate the assumed group-mean variances or zero cross-group covariances.