Tutorials › Multivariate Statistics (Graduate) › Worked Construction of H and E Under General Restrictions

Hypothesis Testing in Linear Models · Tutorial 327 of 975

Worked Construction of H and E Under General Restrictions

Work through a general coefficient restriction from its dimensions and estimability to the restricted fit and the resulting H and E matrices.

Intermediate 12 min read

What You'll Learn

  • Identify the dimensions and rank conditions for a restriction C B M = Theta.
  • Check whether a coefficient contrast is estimable from the design matrix.
  • Derive the restricted least-squares coefficient estimate under the restriction.
  • Construct H from the change in fitted coefficients and E from unrestricted residuals.
  • Verify the matrices by direct calculation from an explicit multivariate data set.

From a General Restriction to H and E

In a multivariate linear model, a restriction can combine predictor coefficients and response directions at the same time. The notation \(C B M=\Theta\) expresses this compactly: \(C\) selects or combines rows of the coefficient matrix, while \(M\) selects or combines response directions. To construct the hypothesis and error sum-of-squares matrices correctly, keep track of those dimensions, check estimability, and distinguish the unrestricted residual variation from the variation attributable to imposing the restriction.

We use the model \(Y=XB+U\), where \(Y\) is an \(n\times p\) response matrix, \(X\) is an \(n\times q\) design matrix, and \(B\) is a \(q\times p\) coefficient matrix. Assume \(X\) has full column rank, and write \(S=X'X\). The unrestricted least-squares estimate is \(\hat B=S^{-1}X'Y\). The restriction matrices have dimensions \(C:r\times q\), \(M:p\times s\), and \(\Theta:r\times s\).

Definition: A restriction \(C B M=\Theta\) is estimable when the linear function of the model parameters on its left is determined by the distribution of the observations. Under the full-column-rank assumption on \(X\), every coefficient contrast \(C B\), and hence every restriction of this form, is estimable. For the formulas below, assume \(C\) has full row rank and \(M\) has full column rank.

The full-rank conditions make the matrices \(C S^{-1}C'\) and \(M'M\) invertible. They also ensure that any \(r\times s\) target \(\Theta\) can be attained by some coefficient matrix \(B\). Let \(D=C\hat B M-\Theta\) be the discrepancy between the unrestricted estimate and the target. The restricted estimate is obtained by correcting \(\hat B\) just enough, in least-squares distance, to remove that discrepancy.

Estimability: A Design-Based Check

When \(X\) is not full column rank, not every coefficient contrast is identifiable. Let \(X^+\) denote the Moore–Penrose inverse. A row contrast \(cB\) is estimable exactly when \(c=cX^+X\), meaning that \(c\) lies in the row space of \(X\). For a nonzero, full-column-rank \(M\), the restriction \(CBM\) is estimable exactly when every row of \(C\) is estimable. In the full-rank setting used for the main construction, \(X^+X=I_q\), so this condition holds for any \(C\).

Worked Example: Checking Estimability With a Rank-Deficient Design

Suppose \(X\) has two identical columns, so its row space is spanned by \((1,1)\). Consider the contrasts \(c_1=(1,1)\) and \(c_2=(1,0)\). Check which is estimable.

The contrast \(c_1\) lies in the row space: it is exactly \((1,1)\). Its value depends on the sum of the two coefficients, which the design can identify. Thus \(c_1B\) is estimable.

The contrast \(c_2\) is not a multiple of \((1,1)\), so it does not lie in the row space. In fact, when the two columns of \(X\) are identical, adding \(a\) to the first coefficient and subtracting \(a\) from the second leaves \(XB\) unchanged but changes the first coefficient. Thus \(c_2B\) is not estimable. A restriction involving \(c_2B M\) with nonzero full-column-rank \(M\) does not become estimable merely by combining response directions.

Restricted Least Squares and the Hypothesis Matrix

Write \(S=X'X\), \(A=(C S^{-1}C')^{-1}\), and \(G=(M'M)^{-1}\). The correction to the unrestricted estimate is \(\Delta=S^{-1}C'A D G M'\). It has dimensions \(q\times p\), just like \(B\). The restricted estimate is \(\tilde B=\hat B-\Delta\). The next result derives this formula and the resulting hypothesis matrix.

Theorem: Under the stated full-rank conditions, the least-squares estimate subject to \(C B M=\Theta\) is \(\tilde B=\hat B-S^{-1}C'(C S^{-1}C')^{-1}(C\hat B M-\Theta)(M'M)^{-1}M'\). The hypothesis sum-of-squares-and-cross-products matrix, defined as the increase in residual cross-products caused by imposing the restriction, is \(H=\Delta'S\Delta=M(M'M)^{-1}D'(C S^{-1}C')^{-1}D(M'M)^{-1}M'\).

Proof. Any candidate coefficient matrix can be written \(\hat B-K\). Since \(X'\!(Y-X\hat B)=0\), its residual sum of squares is \[ (Y-X(\hat B-K))'(Y-X(\hat B-K)) =E+K'SK, \] where \(E=(Y-X\hat B)'(Y-X\hat B)\). Thus minimizing residual sum of squares subject to the restriction is equivalent to minimizing \(\operatorname{tr}(K'SK)\) subject to \(C K M=D\).

The proposed correction \(\Delta=S^{-1}C'A D G M'\) satisfies the constraint: \[ C\Delta M =(C S^{-1}C')A D G(M'M) =D. \] It is therefore feasible. For any other feasible correction \(K\), set \(L=K-\Delta\); then \(C L M=0\). The cross term in the objective vanishes: \[ \operatorname{tr}(L'S\Delta) =\operatorname{tr}\!\left(L'C'A D G M'\right) =\operatorname{tr}\!\left(G M'L'C'A D\right)=0, \] because \(M'L'C'=(C L M)'=0\). Hence \[ \operatorname{tr}(K'SK) =\operatorname{tr}(\Delta'S\Delta)+\operatorname{tr}(L'SL) \geq \operatorname{tr}(\Delta'S\Delta), \] with equality only when \(L=0\), since \(S\) is positive definite. This proves the restricted estimate formula and its least-squares property.

To obtain \(H\), substitute \(\Delta\) into \(\Delta'S\Delta\), retaining the order of the matrix products: \[ \Delta'S\Delta =M G D'A C S^{-1}S S^{-1}C'A D G M' =M G D'A(C S^{-1}C')A D G M' =M G D'A D G M'. \] The cancellation uses \(C S^{-1}C'\) between the two factors \(A=(C S^{-1}C')^{-1}\). The response-side factors remain \(M\) and \(M'\); no identity involving \(M\) is required. This proves the displayed formula for \(H\). \(\square\)

The unrestricted error matrix is \(E=(Y-X\hat B)'(Y-X\hat B)\). It summarizes residual variation after fitting the unrestricted model. The matrix \(H\) is the additional residual cross-product matrix induced by the restriction; it is not the entire restricted residual matrix.

Result: The restricted residual cross-product matrix is \(E+H\). Indeed, the restricted residual is \(Y-X\tilde B=(Y-X\hat B)+X\Delta\). The cross-products between these two terms vanish because \(X'(Y-X\hat B)=0\), leaving \(E+\Delta'X'X\Delta=E+H\).

Worked Construction With Numerical Data

Take \(n=4\), \(q=p=2\), and let the predictor matrix contain an intercept and a centered predictor \(x=(-3,-1,1,3)'\). Use the following design and response matrices:

$$ X= \begin{pmatrix} 1&-3\\ 1&-1\\ 1&1\\ 1&3 \end{pmatrix}, \qquad Y= \begin{pmatrix} 0&-5\\ 0&-7\\ 2&3\\ 6&5 \end{pmatrix}. $$

We test the single general restriction \(C B M=\Theta\), with \(C=(0,1)\), \(M=(1,1)'\), and \(\Theta=(1)\). Thus the slope coefficients for the two responses must sum to one. The dimensions are \(C:1\times2\), \(B:2\times2\), \(M:2\times1\), and \(\Theta:1\times1\). Both restriction matrices have the required rank. The design has full column rank because its columns are nonzero and orthogonal, so \(C\) is estimable.

First calculate the design cross-product and unrestricted estimate:

$$ S=X'X= \begin{pmatrix} 4&0\\ 0&20 \end{pmatrix}, \qquad X'Y= \begin{pmatrix} 8&-4\\ 20&40 \end{pmatrix}, \qquad \hat B=S^{-1}X'Y= \begin{pmatrix} 2&-1\\ 1&2 \end{pmatrix}. $$

The unrestricted slope sum is \(C\hat B M=(1,2)(1,1)'=3\), so \(D=3-1=2\). Also, \(C S^{-1}C'=1/20\), \(A=20\), and \(M'M=2\), so \(G=1/2\). The coefficient correction is

$$ \Delta =S^{-1}C'A D G M' = \begin{pmatrix}0\\1/20\end{pmatrix} (20)(2)(1/2) \begin{pmatrix}1&1\end{pmatrix} = \begin{pmatrix} 0&0\\ 1&1 \end{pmatrix}. $$

Consequently, \(\tilde B=\hat B-\Delta= \begin{pmatrix}2&-1\\0&1\end{pmatrix}\). Checking the restriction gives \(C\tilde B M=(0,1)(1,1)'=1=\Theta\), as required.

The hypothesis matrix is

$$ H=\Delta'S\Delta = \begin{pmatrix}0&1\\0&1\end{pmatrix} \begin{pmatrix}4&0\\0&20\end{pmatrix} \begin{pmatrix}0&0\\1&1\end{pmatrix} = \begin{pmatrix}20&20\\20&20\end{pmatrix}. $$

For the unrestricted error matrix, the fitted values are \(X\hat B\). Subtracting these from the two response columns of \(Y\) gives residual vectors \((1,-1,-1,1)'\) and \((2,-4,2,0)'\). Their squared lengths are \(4\) and \(24\), and their inner product is \(4\). Therefore

$$ E= \begin{pmatrix}4&4\\4&24\end{pmatrix}, \qquad E+H= \begin{pmatrix}24&24\\24&44\end{pmatrix}. $$

Worked Example: Direct Check of the Restricted Error Matrix

Using the restricted estimate just obtained, calculate the residuals directly to verify the \(E+H\) result. The restricted fitted columns are \(2\) and \(-1+x\). Subtracting them from the observed columns gives residual vectors \(( -2,-2,0,4)'\) and \((-1,-5,3,3)'\).

Their cross-products are \((-2)^2+(-2)^2+0^2+4^2=24\) for the first column, \((-1)^2+(-5)^2+3^2+3^2=44\) for the second, and \((-2)(-1)+(-2)(-5)+0(3)+4(3)=24\) between columns. The directly computed restricted residual matrix is therefore \(\begin{pmatrix}24&24\\24&44\end{pmatrix}=E+H\), matching the decomposition.

What the Matrices Reveal—and a Common Pitfall

The example illustrates why \(H\) and \(E\) are separate matrices. \(E\) records the residual cross-products under the unrestricted fit, whereas \(H\) records the extra residual cross-products from the restriction. Both are \(p\times p\), symmetric, and positive semidefinite. For \(H\), this follows directly from \(H=\Delta'S\Delta\) and positive definiteness of \(S\); for \(E\), it follows because \(E\) is a residual matrix cross-product. In the example, \(H\) has identical rows and columns because the correction acts in the response direction \(M=(1,1)'\).

Common pitfall: It is tempting to simplify the formula for \(H\) by claiming that a response-side product involving \(M\) and \((M'M)^{-1}\) equals an identity matrix. This is generally invalid: the dimensions need not even permit that multiplication. Instead, substitute the full expression for \(\Delta\) into \(\Delta'S\Delta\), keep the factors in their valid order, and cancel only the middle predictor-space factor \(C S^{-1}C'\) against its inverse. The response-side factors \(M(M'M)^{-1}\) and \((M'M)^{-1}M'\) remain in the final formula.

A reliable construction therefore follows a fixed sequence: verify dimensions and estimability; compute \(\hat B\) and the discrepancy \(D\); form \(\Delta\) and check that \(C\tilde B M=\Theta\); then compute \(H=\Delta'S\Delta\) and \(E=(Y-X\hat B)'(Y-X\hat B)\). As a final numerical check, the restricted residual cross-product matrix must equal \(E+H\).

Check Your Understanding

Use the definitions and derivations above to answer the following questions.

  1. For \(C:r\times q\), \(B:q\times p\), and \(M:p\times s\), what are the dimensions of \(CBM\) and \(\Theta\)?
  2. Why does full column rank of \(X\) make every coefficient contrast estimable?
  3. In the numerical example, verify \(C\Delta M=D\) directly using the displayed \(\Delta\).
  4. Explain why the factors involving \(M\) remain on both sides of \(D'A D\) in the formula for \(H\).
  5. What matrix is obtained by adding \(H\) to \(E\), and what does it represent?
Clinical Biostats