Tutorials › Multivariate Statistics (Graduate) › Common Errors in Forming Hypothesis Matrices

Hypothesis Testing in Linear Models · Tutorial 331 of 975

Common Errors in Forming Hypothesis Matrices

Check the dimensions, rank, and orientation of restriction matrices before interpreting or testing a multivariate hypothesis.

Intermediate 10 min read

What You'll Learn

  • Set up the dimensions of the coefficient matrix and restriction matrices consistently.
  • Recognize when a transposed restriction matrix cannot multiply the coefficient matrix.
  • Determine how redundant restriction rows affect the number of independent constraints.
  • Check whether a right-hand-side matrix is compatible with dependent restrictions.
  • Distinguish predictor-side contrasts from response-side contrasts.
  • Verify scalar contrasts by calculating them directly from the coefficient matrix.

Why Matrix Errors Change the Hypothesis

In a multivariate linear model, a hypothesis is a statement about particular combinations of regression coefficients. A matrix can look plausible and still encode the wrong combinations: a transpose may make multiplication impossible, repeated rows may overstate the number of restrictions, and a contrast placed on the wrong side of the coefficient matrix may answer a different scientific question.

The safest first step is to write down the dimensions and meaning of every matrix. We use \(Y\) for an \(n \times q\) response matrix, \(X\) for an \(n \times p\) design matrix, and \(B\) for the \(p \times q\) coefficient matrix in the mean model \(E[Y]=XB\). Rows of \(B\) correspond to predictor terms; columns correspond to responses.

Definition: In the convention used here, a general linear hypothesis is written \(H_0:CBA=D\), where \(C\) is an \(r \times p\) predictor-side restriction matrix, \(A\) is a \(q \times s\) response-side contrast matrix, and \(D\) is an \(r \times s\) specified matrix. The dimensions follow from \(B\) being \(p \times q\): \(CBA\) is \(r \times s\).

The left matrix \(C\) forms combinations of predictor coefficients. The right matrix \(A\) forms combinations of responses. For example, if \(c^\mathsf{T}\) is a row vector and \(a\) is a column vector, then \(c^\mathsf{T}Ba\) is a scalar: first \(Ba\) combines response coefficients for each predictor, then \(c^\mathsf{T}\) contrasts those predictor terms. With \(A=I_q\), a hypothesis can constrain predictor effects across all responses. With \(C=I_p\), it can constrain coefficient combinations for selected response contrasts.

Three Checks Before Interpreting a Hypothesis

A matrix restriction should pass three separate checks. Passing one does not guarantee passing the others.

  • Dimension check: Do the matrices multiply in the stated order, and does the result have the same dimensions as \(D\)?
  • Rank check: Do the rows or columns contain redundant restrictions, so the written count exceeds the number of independent constraints?
  • Meaning check: Does each restriction act on the intended predictor or response dimension?

These checks matter because a hypothesis is not just a collection of numbers. It is a linear map applied to \(B\), together with a target value \(D\). Changing the orientation or rank of that map can change the hypothesis, even when the entries appear familiar.

Worked Example: Correcting a Transposed Predictor Restriction

Suppose there are \(p=3\) predictor terms and \(q=2\) responses, with

$$ B= \begin{pmatrix} 1&4\\ 2&-1\\ 5&3 \end{pmatrix}. $$

To test whether the second predictor term has zero coefficients for both responses, use \(C=(0,1,0)\), \(A=I_2\), and \(D=0_{1\times 2}\). The multiplication is

$$ CB A = (0,1,0) \begin{pmatrix} 1&4\\ 2&-1\\ 5&3 \end{pmatrix} = \begin{pmatrix}2&-1\end{pmatrix}. $$

Thus the stated null \(CBA=D\) would require both \(2=0\) and \(-1=0\) for this particular coefficient matrix, so it is not satisfied.

A common error is to write \(C^\mathsf{T}B\). Here \(C^\mathsf{T}\) is \(3 \times 1\), while \(B\) is \(3 \times 2\); the product is undefined because the inner dimensions, 1 and 3, do not match. A consistent transpose version is \(B^\mathsf{T}C^\mathsf{T}\), which is \(2 \times 1\) and equals \((CB)^\mathsf{T}=(2,-1)^\mathsf{T}\). It represents the transposed result, not a reason to use \(C^\mathsf{T}B\).

Redundant Restrictions and Incompatible Targets

The number \(r\) of rows of \(C\) is not necessarily the number of independent predictor restrictions. If some rows are linear combinations of others, then they repeat information. The same issue can occur in the response contrast matrix \(A\). Moreover, dependent left-hand restrictions must have compatible target values in \(D\): repeating a restriction with a different target does not create an additional valid restriction; it makes the null hypothesis impossible.

Theorem: For \(H_0:CBA=D\), the scalar linear constraints on the entries of \(B\) are represented by \(K\operatorname{vec}(B)=\operatorname{vec}(D)\), where \(K=A^\mathsf{T}\otimes C\) and \(\operatorname{vec}\) stacks matrix columns. The number of independent scalar constraints, if the system is consistent, is \(\operatorname{rank}(A)\operatorname{rank}(C)\). In particular, if \(C\) has full row rank \(r\) and \(A\) has full column rank \(s\), there are \(rs\) independent scalar constraints.

Proof. The column-stacking identity \(\operatorname{vec}(CBA)=(A^\mathsf{T}\otimes C)\operatorname{vec}(B)\) gives the stated linear system. Write \(c=\operatorname{rank}(C)\) and \(a=\operatorname{rank}(A)\). By invertible row and column operations, \(C\) can be reduced to a matrix with an identity block of size \(c\) and zeros elsewhere, and \(A^\mathsf{T}\) can be reduced to one with an identity block of size \(a\) and zeros elsewhere. The corresponding invertible transformations on the Kronecker product reduce \(A^\mathsf{T}\otimes C\) to the Kronecker product of those two reduced matrices. That product has exactly \(ac\) nonzero independent unit entries, so its rank is \(ac\). Invertible transformations preserve rank. Thus \(\operatorname{rank}(K)=ac\), which is the number of independent equations when the target is consistent. If the system is inconsistent, there is no \(B\) satisfying the displayed null. \(\square\)

This result counts independent scalar equations, not automatically the degrees of freedom used by a particular multivariate test. Its practical value here is diagnostic: the written number of matrix entries need not equal the number of independent restrictions.

Worked Example: Finding Redundancy and Checking the Target

Let \(p=3\), \(q=2\), \(A=I_2\), and

$$ C= \begin{pmatrix} 1&0&1\\ 2&0&2\\ 0&1&0 \end{pmatrix}. $$

The second row is twice the first, so \(\operatorname{rank}(C)=2\), not 3. If \(D=0_{3\times 2}\), then \(CB=0\) contains six displayed scalar equations, but only \(2 \times 2=4\) independent scalar constraints. In fact, for any \(3 \times 2\) matrix \(B\), the second row of \(CB\) is twice its first row, and the third row supplies two further constraints.

Now suppose the first row of \(D\) is \((0,0)\) and the second row is \((1,0)\). The first row of \(CB=D\) requires the first row of \(CB\) to be \((0,0)\). Because the second row of \(C\) is twice the first, the second row of \(CB\) must then also be \((0,0)\), not \((1,0)\). No \(B\) satisfies this hypothesis. The restriction is inconsistent, not merely redundant.

Predictor Contrasts Versus Response Contrasts

The side on which a contrast matrix multiplies \(B\) determines what is being combined. A predictor contrast is on the left: \(c^\mathsf{T}B\) compares or combines predictor terms separately for each response. A response contrast is on the right: \(Ba\) combines response coefficients separately for each predictor. When both are present, \(c^\mathsf{T}Ba\) combines in both directions.

This distinction remains important even when a proposed multiplication happens to be dimensionally valid. Dimensions can rule out some mistakes, but they cannot confirm that the chosen contrast answers the intended question. To check meaning, name the rows and columns of \(B\) and calculate the desired contrast explicitly.

Worked Example: Keeping the Two Contrast Directions Straight

Let there be two predictor terms and three responses, with

$$ B= \begin{pmatrix} 1&2&0\\ 4&1&5 \end{pmatrix}. $$

The predictor contrast \(c^\mathsf{T}=(1,-1)\) subtracts the second predictor’s coefficients from the first predictor’s coefficients, response by response:

$$ c^\mathsf{T}B = (1,-1) \begin{pmatrix} 1&2&0\\ 4&1&5 \end{pmatrix} = \begin{pmatrix}-3&1&-5\end{pmatrix}. $$

The response contrast \(a=(1,0,-1)^\mathsf{T}\) subtracts the third response coefficient from the first, predictor by predictor:

$$ Ba = \begin{pmatrix} 1&2&0\\ 4&1&5 \end{pmatrix} \begin{pmatrix}1\\0\\-1\end{pmatrix} = \begin{pmatrix}1\\-1\end{pmatrix}. $$

Using both contrasts gives the scalar

$$ c^\mathsf{T}Ba = (1,-1) \begin{pmatrix}1\\-1\end{pmatrix} =2. $$

The two intermediate results answer different questions: \(c^\mathsf{T}B\) has one entry per response, while \(Ba\) has one entry per predictor. Reversing the intended meaning of \(c\) and \(a\) can therefore produce either a dimension error or a valid-looking but different hypothesis.

A Reliable Diagnostic Workflow

Before using a hypothesis in a test, check it in a fixed order. This separates mechanical matrix errors from substantive interpretation errors.

1
Write the coefficient dimensions.
Record \(B\) as \(p \times q\), with predictors indexing rows and responses indexing columns.
2
Label each contrast by its side.
Check that \(C\) is \(r \times p\) and acts on predictors from the left; check that \(A\) is \(q \times s\) and acts on responses from the right.
3
Confirm the target shape.
Since \(CBA\) is \(r \times s\), \(D\) must also be \(r \times s\).
4
Check rank and compatibility.
Look for dependent rows or columns, and verify that the corresponding entries of \(D\) obey the same dependencies.
5
Calculate a small contrast directly.
For a single predictor and response contrast, compute \(c^\mathsf{T}Ba\) from the stated coefficients and compare it with the scientific claim.
Common pitfall: “There are three rows in \(C\), so this hypothesis imposes three independent restrictions for each response.” This is wrong if any row of \(C\) is a linear combination of the others. Compute \(\operatorname{rank}(C)\); with a full response matrix \(A=I_q\), the number of independent scalar restrictions is \(q\,\operatorname{rank}(C)\), provided the target is compatible. A separate mistake is to transpose a contrast and then silently change the multiplication order. A transpose is safe only when the entire product and its target are transposed consistently.

Why These Checks Matter

A test procedure operates on the hypothesis that is encoded, not the one intended in the analyst’s notes. A transposed matrix may prevent a calculation, while a redundant matrix may make a restriction count look larger than it is. An incompatible target can define an empty null, and a contrast on the wrong side can test a different relationship altogether. These errors can affect the reported hypothesis and the interpretation of a result even when the subsequent algebra is carried out correctly.

The practical habit is simple: annotate each matrix with its dimensions and meaning, verify the multiplication, check rank and target compatibility, and evaluate at least one contrast in words and arithmetic. This complements the earlier material on rank conditions for classical multivariate tests: a valid test calculation starts with a correctly formed restriction.

Check Your Understanding

For each question, consider both the matrix dimensions and the meaning of the restriction.

  1. If \(B\) is \(4 \times 3\), what dimensions must \(C\) and \(A\) have for \(CBA\) to be defined?
  2. Why does \(C^\mathsf{T}B\) generally fail when \(C\) is a row contrast of predictor coefficients? What consistently transposed product represents the same information?
  3. If \(C\) has two identical rows and \(A=I_q\), how many independent scalar restrictions can \(CBA=D\) impose, assuming the target is compatible?
  4. What must be true of the rows of \(D\) when one row of \(C\) is twice another?
  5. In \(c^\mathsf{T}Ba\), which vector contrasts predictors and which contrasts responses? State the dimensions of each vector.
Clinical Biostats