Tutorials › Multivariate Statistics (Graduate) › Testing Response-Space Contrasts

Hypothesis Testing in Linear Models · Tutorial 322 of 975

Testing Response-Space Contrasts

Form hypotheses about selected linear combinations of responses while retaining the full predictor model, then construct and test the corresponding restrictions.

Intermediate 12 min read

What You'll Learn

  • Express selected response combinations using a response contrast matrix
  • Translate scientific questions into restrictions on transformed regression coefficients
  • Preserve nuisance predictor effects while testing response-space hypotheses
  • Construct hypothesis and error sum-of-squares matrices for transformed responses
  • Apply Wilks’ likelihood-ratio test or the exact scalar-response F test
  • Identify rank and residual degrees-of-freedom conditions

Why Change the Response Coordinates?

A multivariate regression records several outcomes for each subject, but a scientific question may concern only a particular combination of them. For example, a study might ask whether a treatment changes the difference between two outcomes, or whether a weighted average of several outcomes has a specified predictor effect. A response-space contrast makes that target explicit: it changes which response combinations are tested without removing predictors or altering the rest of the regression model.

Let \(Y\) be an \(n\times p\) response matrix and \(X\) an \(n\times k\) full-column-rank design matrix. Write the multivariate linear model as \(Y=XB+U\), where \(B\) is \(k\times p\). Assume the rows of \(U\) are independent and distributed as \(N_p(0,\Sigma)\), with \(\Sigma\) positive definite. A response contrast matrix \(M\), of size \(p\times q\), forms the transformed responses \(Z=YM\). The transformed coefficient matrix is \(BM\), and the row covariance of the transformed errors is \(\Sigma_M=M'\Sigma M\).

Definition: A response-space restriction is a hypothesis about \(BM\), the regression coefficient matrix for the selected response combinations. In general form it is \(H_0:C B M=\Theta\), where \(C\) is an \(r\times k\) predictor-contrast matrix of rank \(r\), \(M\) is a \(p\times q\) response-contrast matrix of rank \(q\), and \(\Theta\) is a specified \(r\times q\) matrix. The predictor effects not restricted by \(C\) remain nuisance effects in the model.

The dimensions help clarify the roles of the two contrast matrices. Multiplication by \(C\) selects predictor-side coefficient contrasts; multiplication by \(M\) selects response combinations. This tutorial focuses on using \(M\) to define the outcomes of interest. The transformed model still uses the same design matrix \(X\), so the other predictor effects are fitted rather than discarded.

From Response Contrasts to a Test

Define \(\hat B=(X'X)^{-1}X'Y\), the ordinary least-squares estimator in the full model, and let \(\hat\Gamma=\hat B M\). Set \(A=C(X'X)^{-1}C'\), which is positive definite when \(C\) has full row rank. The discrepancy from the null restriction is the \(r\times q\) matrix \(D=C\hat B M-\Theta\). The hypothesis and error sum-of-squares matrices for the transformed responses are

$$ H_M=D'A^{-1}D,\qquad E_M=M'Y'(I-P_X)YM,\qquad P_X=X(X'X)^{-1}X'. $$

Both matrices are \(q\times q\). \(H_M\) measures the fitted discrepancy from the specified restriction, scaled for the predictor contrasts, while \(E_M\) is the residual cross-product matrix from fitting the full predictor model to the selected responses. The subscripts emphasize that these matrices depend on the response combinations selected by \(M\).

Theorem: Under the Gaussian model above, suppose \(C\) has rank \(r\), \(M\) has rank \(q\), and \(n-k=\nu\ge q\). Under \(H_0:C B M=\Theta\), \(H_M\) and \(E_M\) are independent, with distributions \(W_q(\Sigma_M,r)\) and \(W_q(\Sigma_M,\nu)\), respectively. In particular, \(E_M\) is positive definite with probability one. The likelihood-ratio statistic can therefore be written as Wilks’ lambda, \(\Lambda=|E_M|/|E_M+H_M|\), with its null distribution determined by \(q,r,\nu\).

Here \(W_q(\Sigma_M,d)\) denotes the \(q\)-dimensional Wishart distribution with scale matrix \(\Sigma_M\) and \(d\) degrees of freedom. The theorem requires a nonsingular transformed covariance matrix; because \(\Sigma\) is positive definite and \(M\) has full column rank, \(\Sigma_M=M'\Sigma M\) is positive definite.

1
Fit the full model.
Compute \(\hat B\) and the residual cross-product matrix \(Y'(I-P_X)Y\), retaining every predictor in \(X\).
2
Form the selected responses.
Compute \(\hat B M\) and \(E_M=M'Y'(I-P_X)YM\). These are the fitted coefficients and error matrix for \(YM\).
3
Measure departure from the null.
Form \(D=C\hat B M-\Theta\), then calculate \(H_M=D'[C(X'X)^{-1}C']^{-1}D\).
4
Calibrate the test.
For multiple selected responses, use a classical multivariate test such as Wilks’ lambda with the appropriate null distribution. For one selected response, the exact partial F test is available under the Gaussian assumptions.

Why the Matrices Give the Restricted-Model Test

The connection between \(H_M\) and the restricted model follows by minimizing the transformed residual sum of squares subject to \(C\Gamma=\Theta\), where \(\Gamma=BM\). Its unrestricted least-squares estimate is \(\hat\Gamma=\hat B M\). The constrained estimate is

$$ \tilde\Gamma = \hat\Gamma-(X'X)^{-1}C'A^{-1}(C\hat\Gamma-\Theta). $$

Indeed, multiplying by \(C\) gives \(C\tilde\Gamma=C\hat\Gamma-AA^{-1}(C\hat\Gamma-\Theta)=\Theta\). The adjustment is the least-squares correction satisfying the restrictions. The increase in residual cross-products from imposing them is

$$ (\tilde\Gamma-\hat\Gamma)'X'X(\tilde\Gamma-\hat\Gamma) \quad\text{in the predictor-weighted form, yielding}\quad D'A^{-1}D=H_M. $$

More explicitly, the cross-product increase is \((\tilde\Gamma-\hat\Gamma)'X'X(\tilde\Gamma-\hat\Gamma)\). Substituting the adjustment gives \(D'A^{-1}C(X'X)^{-1}X'X(X'X)^{-1}C'A^{-1}D=D'A^{-1}D\), because \(C(X'X)^{-1}C'=A\). The residuals from the unrestricted fit are orthogonal to the columns of \(X\), so the cross-terms between unrestricted residuals and the fitted-value adjustment are zero. Thus the restricted residual cross-product matrix is exactly \(E_M+H_M\). This proves that the matrices compare the restricted and unrestricted fits for the selected responses.

For the distribution statement, \(C\hat B M-\Theta\) is matrix normal under the null, with row covariance \(A\) and column covariance \(\Sigma_M\). Whiten its rows by \(A^{-1/2}\): the resulting \(r\times q\) matrix has independent \(N_q(0,\Sigma_M)\) rows. Its cross-product is \(H_M\), so \(H_M\sim W_q(\Sigma_M,r)\). The residual projection \(I-P_X\) has rank \(\nu=n-k\); under normality, an orthogonal change of coordinates separates the fitted and residual components. Hence \(E_M\sim W_q(\Sigma_M,\nu)\) and is independent of \(\hat B M\), and therefore of \(H_M\). Since \(\nu\ge q\) and \(\Sigma_M\) is positive definite, \(E_M\) is positive definite almost surely. These facts establish the theorem. \(\square\)

Worked Examples

Worked Example: Testing a Difference Between Two Outcomes

Suppose the outcomes are systolic blood pressure and diastolic blood pressure, in that order, and the predictor of interest is treatment, with its coefficient in the first row of \(B\). The question is whether treatment changes the difference between the two pressures by zero. Choose \(M=(1,-1)'\), so \(YM\) is systolic minus diastolic pressure, and let \(C=(1,0,\ldots,0)\) select the treatment coefficient. Then \(C B M\) is the treatment effect on the difference.

The null hypothesis is \(H_0:C B M=0\). If the fitted treatment effects are 5 mmHg for systolic and 2 mmHg for diastolic pressure, then \(C\hat B M=5-2=3\) mmHg, so the estimated difference in treatment effects is 3 mmHg. The test uses this discrepancy and the residual variability of the transformed outcome \(Y M\), while retaining the other predictors in \(X\). It does not test whether either outcome’s treatment effect is separately zero.

Worked Example: Constructing the Multivariate Matrices

Suppose two response contrasts are selected, with \(q=2\), and the predictor restriction has \(r=1\) degree of freedom. Take \(\nu=30\), \(A=1\), and observed discrepancy \(D=(0.6,-0.2)\). Suppose the transformed error matrix is

$$ E_M= \begin{pmatrix} 18&3\\ 3&12 \end{pmatrix}. $$

The hypothesis matrix is the outer product \(H_M=D'D\):

$$ H_M= \begin{pmatrix} 0.6\\-0.2 \end{pmatrix} \begin{pmatrix} 0.6&-0.2 \end{pmatrix} = \begin{pmatrix} 0.36&-0.12\\ -0.12&0.04 \end{pmatrix}. $$

The residual covariance estimate is \(E_M/\nu=\begin{pmatrix}0.6&0.1\\0.1&0.4\end{pmatrix}\). Its determinant is \(0.6(0.4)-0.1^2=0.23\), so its inverse is

$$ \left(\frac{E_M}{\nu}\right)^{-1} = \frac{1}{0.23} \begin{pmatrix} 0.4&-0.1\\ -0.1&0.6 \end{pmatrix} = \begin{pmatrix} 1.739&-0.435\\ -0.435&2.609 \end{pmatrix}, $$

where the displayed entries are rounded to three decimals. For example, \(0.4/0.23=1.73913\) and \(0.6/0.23=2.60870\). The error determinant is \(|E_M|=18(12)-3^2=207\). Also,

$$ E_M+H_M= \begin{pmatrix} 18.36&2.88\\ 2.88&12.04 \end{pmatrix}, \qquad |E_M+H_M|=18.36(12.04)-2.88^2=212.76. $$

Thus Wilks’ lambda is \(\Lambda=207/212.76\approx0.9729\). This value is assessed against the null distribution for \(q=2\), \(r=1\), and \(\nu=30\). The calculation alone is not a decision: a significance level or a p-value from that distribution is needed to decide whether to reject the null.

Worked Example: An Exact Test for One Response Contrast

Suppose a single response contrast is selected, so \(q=1\), and the null imposes \(r=2\) independent restrictions. Let the observed scalar hypothesis sum of squares be \(H_M=16\), and let the error sum of squares be \(E_M=48\) with \(\nu=24\) residual degrees of freedom. The partial F statistic is

$$ F=\frac{H_M/r}{E_M/\nu} =\frac{16/2}{48/24} =\frac{8}{2}=4. $$

Under the null and the Gaussian linear-model assumptions, this has an \(F_{2,24}\) distribution. The numerator degrees of freedom are the rank \(r=2\) of the tested predictor restrictions; the denominator degrees of freedom are the full-model residual degrees of freedom. The test concerns the selected response combination only, not each original response separately.

What the Response Contrast Preserves

Selecting \(M\) changes the outcome being analyzed, not the predictor model. The transformed data satisfy \(YM=X(BM)+UM\), with the same \(X\) as before. Consequently, nuisance predictor coefficients remain in the fit and are accounted for by \(P_X\) and the residual degrees of freedom \(n-k\). A response contrast is therefore not a license to drop covariates that were part of the specified model.

The choice of \(M\) also determines what the test can say. If its columns are linearly independent, it selects \(q\) distinct response directions. A scalar contrast such as \(M=(1,-1)'\) tests one direction; a matrix \(M\) can select several combinations jointly. The test does not automatically describe effects in response directions outside the column space of \(M\).

Common Pitfall and Conditions

  • Testing the wrong hypothesis. Testing \(C B M=\Theta\) is generally not the same as testing \(CB=\Theta\), nor is it the same as testing each response coefficient separately. Write out the response combinations represented by the columns of \(M\).
  • Dropping nuisance predictors. The response transformation does not remove columns of \(X\). Use the full-model residual matrix \(E_M=M'Y'(I-P_X)YM\), not residuals from an unintended smaller predictor model.
  • Ignoring rank or degrees of freedom. \(C\) and \(M\) should have the stated full ranks, \(X\) must have full column rank, and the usual nonsingular-error multivariate test requires \(\nu\ge q\). If these conditions fail, the displayed inverse or standard calibration may not be valid.
  • Interpreting a multivariate result one response at a time. A joint rejection concerns the selected set of response combinations. It does not, by itself, identify which coordinate or contrast drives the result.
Key takeaway: Specify response-space questions through \(M\), then test \(C B M=\Theta\) using the transformed hypothesis and error matrices. The predictor design stays intact, so nuisance predictor effects remain controlled by the full model.

Check Your Understanding

Use the model and conditions stated above to answer the following.

  1. For \(p=3\), what response combination is formed by \(M=(1,0,-1)'\)?
  2. In \(H_0:C B M=\Theta\), which matrix selects predictor contrasts and which selects response combinations?
  3. Why is \(E_M\) formed using the full-model projection \(P_X\), even when the hypothesis focuses on only one response contrast?
  4. In the scalar-response example, why are the F-test degrees of freedom \(2\) and \(24\)?
  5. State two conditions that ensure the transformed error matrix is positive definite with probability one under the Gaussian model.
Clinical Biostats