Tutorials › Multi-Arm Multi-Stage (MAMS) Designs › Incidence-Matrix Construction of Contrasts

Shared-Control Correlation · Tutorial 93 of 499

Incidence-Matrix Construction of Contrasts

Learn to encode treatment-control comparisons as rows of an incidence matrix and obtain their joint covariance from the variances of the group means.

Advanced 12 min read

What You'll Learn

  • Define the group-mean vector and the incidence matrix for treatment-control comparisons
  • Derive the covariance matrix as a matrix product
  • Calculate covariances under common and unequal group variances
  • Check contrast signs, dimensions, and covariance entries for errors
  • Compare matrix construction with pairwise covariance calculations

From Treatment Arms to a Contrast Matrix

When several treatments are compared with one shared control, each estimated treatment-control difference uses the same control-group mean. The comparisons are therefore connected: their covariance depends on the variance of that shared mean. An incidence matrix makes the signs and group membership explicit, so the covariance structure can be calculated systematically rather than assembled one pair at a time.

Consider a parallel-group design with one control group, indexed by \(0\), and \(K\) treatment groups, indexed by \(1,\ldots,K\). Let \(\bar{Y}_g\) be the sample mean in group \(g\), and let \(\mu_g\) and \(\sigma_g^2\) be that group’s population mean and variance. Assume that observations are independent within and between groups, and that group \(g\) has sample size \(n_g\). For the covariance results below, the variances are finite. Normality is not needed to calculate these covariances.

Definition: The group-mean vector is \(\bar{\mathbf{Y}}=(\bar{Y}_0,\bar{Y}_1,\ldots,\bar{Y}_K)^\mathsf{T}\), and its covariance matrix under independent groups is \(D=\operatorname{diag}(\sigma_0^2/n_0,\sigma_1^2/n_1,\ldots,\sigma_K^2/n_K)\). An incidence matrix \(B\) records the comparisons: each row has a \(-1\) for the group subtracted, a \(+1\) for the group being compared, and zeros elsewhere. The vector of estimated contrasts is \(\hat{\boldsymbol{\theta}}=B\bar{\mathbf{Y}}\).

For a treatment-minus-control comparison, the row for treatment \(j\) has \(-1\) in column \(0\), \(+1\) in column \(j\), and zero in all other columns. Thus its estimated contrast is \(\bar{Y}_j-\bar{Y}_0\). The corresponding population contrast is \(\theta_j=\mu_j-\mu_0\). Every such row sums to zero, as a contrast must: adding the same constant to every group mean would not change any treatment-control difference.

Why the Covariance Is a Matrix Product

The matrix product follows directly from the covariance rule for linear transformations. It is useful to see why each factor appears, because this also provides a check on how to place group variances and contrast coefficients.

1
Write the estimated contrasts as a transformation.
By construction, \(\hat{\boldsymbol{\theta}}=B\bar{\mathbf{Y}}\), where \(B\) has one row per comparison and one column per group.
2
Apply the covariance rule.
For a random vector \(X\) and a fixed matrix \(A\), \(\operatorname{Cov}(AX)=A\operatorname{Cov}(X)A^\mathsf{T}\). Applying this with \(A=B\) and \(X=\bar{\mathbf{Y}}\) gives \(\operatorname{Cov}(\hat{\boldsymbol{\theta}})=B\operatorname{Cov}(\bar{\mathbf{Y}})B^\mathsf{T}\).
3
Use independence of the groups.
Independent group samples give \(\operatorname{Cov}(\bar{Y}_g,\bar{Y}_h)=0\) for \(g\ne h\), while \(\operatorname{Var}(\bar{Y}_g)=\sigma_g^2/n_g\). Hence \(\operatorname{Cov}(\bar{\mathbf{Y}})=D\), and the result is \(BDB^\mathsf{T}\).
$$ \operatorname{Cov}(\hat{\boldsymbol{\theta}}) = \operatorname{Cov}(B\bar{\mathbf{Y}}) = BDB^\mathsf{T}. $$

In entrywise form, if comparison \(r\) has coefficients \(b_{rg}\) and comparison \(s\) has coefficients \(b_{sg}\), then \(\operatorname{Cov}(\hat{\theta}_r,\hat{\theta}_s)=\sum_{g=0}^{K}b_{rg}b_{sg}\sigma_g^2/n_g\). This expression says that only groups appearing in both comparisons can contribute to their covariance. For treatment-control rows, the shared control contributes a positive term because both rows have coefficient \(-1\) for that group.

Theorem: For a fixed contrast matrix \(B\) and independent group means with covariance matrix \(D\), the contrast covariance matrix is \(BDB^\mathsf{T}\). Its diagonal entries are contrast variances; its off-diagonal entries are covariances between pairs of estimated contrasts. The matrix has one row and column per contrast, not per treatment arm.

Worked Examples

Worked Example: Three Treatments Sharing One Control

Suppose a hypothetical trial has one control and three treatment groups. The sample sizes are \(n_0=40\), \(n_1=30\), \(n_2=20\), and \(n_3=25\). Assume independent observations and a common outcome standard deviation of \(10\) units in all four groups. Construct the covariance matrix for the three treatment-minus-control estimates.

The group-mean variances are \(100/40=2.500\), \(100/30=3.333\), \(100/20=5.000\), and \(100/25=4.000\), in squared outcome units. With columns ordered \(0,1,2,3\), the incidence matrix and group-mean covariance matrix are

$$ B= \begin{pmatrix} -1&1&0&0\\ -1&0&1&0\\ -1&0&0&1 \end{pmatrix}, \qquad D= \begin{pmatrix} 2.500&0&0&0\\ 0&3.333&0&0\\ 0&0&5.000&0\\ 0&0&0&4.000 \end{pmatrix}. $$

For example, the variance of the first estimate is \(2.500+3.333=5.833\) squared units. The covariance of the first and second estimates is \((-1)(-1)(2.500)=2.500\) squared units: only the shared control contributes. Multiplying \(BDB^\mathsf{T}\), or applying that same calculation to each pair, gives

$$ \operatorname{Cov}(\hat{\boldsymbol{\theta}}) = \begin{pmatrix} 5.833&2.500&2.500\\ 2.500&7.500&2.500\\ 2.500&2.500&6.500 \end{pmatrix}. $$

The diagonal entries are, respectively, \(2.500+3.333\), \(2.500+5.000\), and \(2.500+4.000\). Each off-diagonal entry is the control-mean variance, \(2.500\). If the observed sample means were \(50,46,42,48\) outcome units in groups \(0,1,2,3\), the estimated contrasts would be \((-4,-8,-2)\) units. Those estimates do not alter the covariance matrix: under the stated model, the covariance depends on group-mean variances and the contrast coefficients, not on the observed means.

Worked Example: Unequal Group-Mean Variances and Contrast Signs

Consider hypothetical control, A, B, and C groups, with group-mean variances \(1.200\), \(2.000\), \(3.000\), and \(4.000\) squared units, respectively. These could arise from unequal population variances, unequal sample sizes, or both. The two estimates are A minus B and C minus A. Calculate their covariance matrix.

Using columns in the order control, A, B, C, the control is not used in these two comparisons, so its column contains zeros. The incidence matrix is

$$ B= \begin{pmatrix} 0&1&-1&0\\ 0&-1&0&1 \end{pmatrix}, \qquad D=\operatorname{diag}(1.200,2.000,3.000,4.000). $$

The first variance is \(2.000+3.000=5.000\) squared units; the second is \(2.000+4.000=6.000\) squared units. For the covariance, only group A appears in both rows, and its coefficients have opposite signs: \((1)(-1)(2.000)=-2.000\) squared units. Therefore,

$$ BDB^\mathsf{T} = \begin{pmatrix} 5.000&-2.000\\ -2.000&6.000 \end{pmatrix}. $$

The negative sign is not an error. When the observed mean in A increases, A minus B increases while C minus A decreases, all else held fixed. Reversing either comparison’s direction would reverse the sign of its covariance with the other comparison, while leaving its variance unchanged.

Worked Example: Recovering a Treatment-to-Treatment Contrast

Suppose a hypothetical study has control, A, and B groups, with group-mean variances \(1.500\), \(2.500\), and \(3.500\) squared units. Begin with the two treatment-control comparisons, A minus control and B minus control. Show how their incidence rows give the A-minus-B contrast and its variance.

The two rows are \((-1,1,0)\) and \((-1,0,1)\). Subtracting the second estimated contrast from the first cancels the shared control:

$$ (\bar{Y}_A-\bar{Y}_0)-(\bar{Y}_B-\bar{Y}_0) = \bar{Y}_A-\bar{Y}_B. $$

The resulting incidence row is \((0,1,-1)\), which encodes A minus B directly. Its variance is obtained from the group-mean variances:

$$ (0,1,-1) \begin{pmatrix} 1.500&0&0\\ 0&2.500&0\\ 0&0&3.500 \end{pmatrix} \begin{pmatrix} 0\\1\\-1 \end{pmatrix} = 2.500+3.500 = 6.000 $$

The control contributes zero because its coefficient in the derived contrast is zero. This agrees with the covariance calculation from the two treatment-control estimates: the variance of their difference is \(4.000+5.000-2(1.500)=6.000\) squared units. The same contrast can therefore be represented either by combining rows or by writing its incidence row directly.

Checks, Alternatives, and Limitations

The matrix construction is especially useful when there are many comparisons, because it keeps the arm ordering, signs, and shared groups visible. Before interpreting a result, check that the matrix has the intended dimensions and coefficients. If there are \(L\) comparisons and \(K+1\) groups, \(B\) must be \(L\) by \(K+1\), \(D\) must be \(K+1\) by \(K+1\), and \(BDB^\mathsf{T}\) must be \(L\) by \(L\).

  • Check each row. For a treatment-minus-control comparison, the control coefficient must be \(-1\), the appropriate treatment coefficient \(+1\), and all other coefficients zero. Each row must sum to zero.
  • Check the diagonal. A contrast variance cannot be negative. For a treatment-control difference it is \(\sigma_0^2/n_0+\sigma_j^2/n_j\).
  • Check the shared-group contribution. Two treatment-minus-control rows have covariance \(+\sigma_0^2/n_0\). If one comparison is reversed, the shared-control contribution changes sign.
  • Check the matrix product. The result must be symmetric. A dimension mismatch, an incorrect transpose, or a misplaced group variance often signals a construction error.

A direct pairwise calculation using the entrywise covariance formula is a useful alternative for only a few contrasts. It can also verify selected entries of a matrix product. However, it becomes easier to omit a shared group or lose a sign as the number of comparisons grows. The incidence-matrix approach applies the same calculation uniformly and exposes the source of every entry.

The result relies on the stated independent-group sampling model, which makes \(D\) diagonal. If group means are correlated, their covariance matrix is not diagonal; the general linear-transformation rule still has the form \(B\operatorname{Cov}(\bar{\mathbf{Y}})B^\mathsf{T}\), but the diagonal \(D\) used here is no longer appropriate. Also, \(BDB^\mathsf{T}\) describes covariance of the estimated contrasts, not the contrasts’ observed values and not a correlation matrix. Correlations require dividing each covariance by the corresponding standard deviations.

Common pitfall: Treating treatment-control estimates as independent because they come from different treatment groups gives zero off-diagonal covariances. That reasoning ignores the control mean present in every estimate. With treatment-minus-control rows, both control coefficients are \(-1\), so their product is \(+1\), and the shared control contributes \(+\sigma_0^2/n_0\) to each covariance. The treatment-group means may be independent of one another while the resulting contrasts are still dependent.
Key takeaway: Put one comparison in each row of \(B\), one group in each column, and encode subtraction with \(-1\) and addition with \(+1\). Under independent groups, the covariance matrix follows from \(\operatorname{Cov}(\hat{\boldsymbol{\theta}})=BDB^\mathsf{T}\), with \(D\) containing the group-mean variances.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. For groups \(0,1,2\), write the incidence matrix for comparisons group 1 minus control and group 2 minus control.
  2. If the control-mean variance is \(2.4\) squared units and the treatment-mean variances are \(1.6\) and \(3.0\) squared units, what is the covariance between the two treatment-minus-control estimates?
  3. For an estimate of group A minus group B, what incidence coefficients should be used in columns ordered control, A, B? Which group-mean variances contribute to its variance?
  4. Why can a covariance between two contrasts be negative even though each contrast variance is nonnegative?

Solutions. (1) The rows are \((-1,1,0)\) and \((-1,0,1)\). (2) The two control coefficients are both \(-1\), so the covariance is \((-1)(-1)(2.4)=2.4\) squared units. (3) Use \((0,1,-1)\); the variance is the sum of the A and B group-mean variances. (4) If a shared group has opposite-signed coefficients in the two contrasts, its contribution to their covariance is negative. A covariance may have either sign, whereas a variance is the covariance of a quantity with itself and cannot be negative.

Clinical Biostats