Why Redundant Columns Matter
A factor with several levels is represented in a model by numeric columns. Those columns, together with the intercept and any interaction columns, form the model matrix. If one column can be written as a linear combination of others, the model matrix is rank deficient: different coefficient vectors then produce the same linear predictor. This is an identifiability problem, not merely an awkward coefficient interpretation.
The issue can arise when all level indicators are included alongside an intercept, when indicators or interaction columns are duplicated, or when the observed data do not contain some factor combinations. A rank check examines the columns actually present in the fitted model matrix, so it can reveal problems that are not obvious from the formula alone.
For a generalized linear model, the linear predictor is \(\eta=X\beta\). If \(Xc=0\), then \(X(\beta+c)=X\beta+Xc=X\beta\). Thus the two different coefficient vectors \(\beta\) and \(\beta+c\) give identical linear predictors for every row. For a model whose likelihood depends on the observations through \(\eta\), the data cannot distinguish those coefficient vectors. The fitted linear predictor may still be determined even though the individual coefficients are not.
Deriving the Full-Indicator Trap
Suppose a factor has \(K\) levels. For observation \(i\), let \(D_{ij}=1\) if the observation is in level \(j\), and \(D_{ij}=0\) otherwise. Every observation is in exactly one level, so its indicators satisfy the identity
The right-hand side is the intercept column. Therefore, with an intercept and all \(K\) indicators, the intercept is exactly the sum of the factor-indicator columns. The columns cannot all be independent. One standard solution is to retain the intercept and use \(K-1\) indicators, treating one level as the reference. Another is to use all \(K\) indicators and omit the intercept. With the second choice, the level-specific means can be represented directly.
A different contrast system can also use \(K-1\) independent columns with an intercept. Sum-to-zero contrasts, for example, impose a constraint on level effects: their sum is zero. The constraint chooses one representation from a set of coefficient vectors that would otherwise give the same fitted values. It does not create information absent from the data.
Worked Example: Finding an Extra Factor Indicator
A hypothetical insurer models a continuous claim-cost measure using a three-level repair-network factor: Local, Regional, or National. The three observed rows below stand for one observation from each level. The analyst proposes an intercept and all three indicators. Find the rank and give a full-rank reference-coded alternative.
Method. Write the model matrix and check whether its columns are independent. Use Local as the reference level for the alternative.
The three indicator columns are independent: their \(3\times3\) submatrix is the identity matrix, so the rank is at least 3. There are only three rows, so the rank cannot exceed 3. Hence \(\operatorname{rank}(X)=3\), although \(X\) has four columns. The dependence is visible directly:
For reference coding, retain the intercept and the Regional and National indicators:
Its determinant is 1, so its rank is 3, equal to its number of columns. The intercept represents the Local level, while the other two columns allow the Regional and National levels to differ from it. The avoided mistake is to keep every indicator merely because the factor has three levels: with an intercept, that adds a redundant fourth column.
Checking Rank in R
In R, inspect the actual matrix used for the model rather than counting terms in the formula. For example, if fit is the fitted model, model.matrix(fit) returns its model matrix. The QR decomposition rank is available as qr(model.matrix(fit))$rank; compare it with ncol(model.matrix(fit)). If the rank is smaller, at least one column is dependent on the others. Functions such as alias(fit) can help identify aliased terms in supported model classes.
This check should be made on the rows actually used to fit the model. Missing-value handling can remove rows, and a factor level may have no observations among the remaining rows. A formula that appears adequate before row removal can therefore have a different rank in the fitted sample. Rank is about exact dependence. Very similar but not exactly dependent columns are a near-collinearity issue, not a rank deficiency; they can make estimates unstable without reducing the mathematical rank.
Use the model matrix after the model's row-selection and factor-contrast choices have been applied.
If \(\operatorname{rank}(X)=p\), the columns are linearly independent. If \(\operatorname{rank}(X)<p\), the coefficient parameterization is redundant.
Look for a full set of indicators plus an intercept, duplicate columns, or interaction columns that are zero or duplicate because of the observed factor combinations.
Use a reference level, an appropriate contrast constraint, or a model specification that matches the combinations represented in the data. Recheck the resulting matrix.
Redundancy in Interactions
An interaction column is formed from products of predictor columns. With binary indicators \(A\) and \(B\), the product \(AB\) equals 1 only when both indicators equal 1. If no observed row has \(A=1\) and \(B=1\), the interaction column is all zero. It adds no independent direction to the model matrix, so its coefficient cannot be estimated from those rows.
With all combinations observed, the intercept, two reference-coded main-effect columns, and their product can provide four independent columns for a two-factor model with two levels per factor. If a combination is absent, the observed matrix must be checked: the formula's written terms alone do not guarantee that each column contributes independent information. This is a statement about the design represented by the observed rows, not a test of whether an interaction is substantively useful.
Worked Example: An Unobserved Combination Leaves the Interaction Unidentified
A hypothetical service team models a response using two binary factors: \(A=1\) denotes a new intake process, and \(B=1\) denotes remote service. The observed combinations are \((0,0)\), \((0,1)\), and \((1,0)\); no row has both factors equal to 1. Using reference-coded columns, determine whether the interaction coefficient is identifiable.
Method. Construct the columns \(1,A,B,AB\) for the observed combinations, then compare the rank with the number of columns.
The \(AB\) column is zero in all three rows. The first three columns are independent: the rows \((1,0,0)\), \((1,0,1)\), and \((1,1,0)\) form a square matrix with determinant \(-1\). Thus the rank is 3, while there are 4 columns. The interaction coefficient is not separately identifiable: changing it has no effect on any observed linear predictor because \(AB=0\) for every row.
The correction is not to interpret a software-generated coefficient as evidence about the missing combination. Instead, report that the observed design does not identify that interaction term, or revise the model only when a simpler structure is substantively justified. The avoided mistake is assuming that writing an interaction in a formula guarantees that its effect is estimable.
Worked Example: Confirming a Full Two-Factor Coding
A hypothetical risk model includes two binary factors, \(A\) and \(B\), with all four combinations represented. It uses an intercept, the reference-coded main effects \(A\) and \(B\), and their product \(AB\). Check the matrix rank.
Method. List the four rows in the order \((0,0),(0,1),(1,0),(1,1)\). Compute the product column row by row.
To check independence, suppose a linear combination of the columns is zero. Let its coefficients be \(c_0,c_A,c_B,c_{AB}\). The first row gives \(c_0=0\). The second row then gives \(c_B=0\), and the third gives \(c_A=0\). The fourth row gives \(c_0+c_A+c_B+c_{AB}=0\), so \(c_{AB}=0\). Only the all-zero combination produces zero; therefore the four columns are independent and the rank is 4.
In this design, the interaction column contributes an independent direction. The conclusion depends on the presence of all four combinations; it should not be carried over to a data set missing a combination. The avoided mistake is treating the rank of one observed design as a property of the formula alone.
Common Mistakes and Practical Interpretation
- Keeping all level indicators with an intercept. Their sum equals the intercept column. Use \(K-1\) indicators with an intercept, or all \(K\) indicators without one.
- Assuming every written interaction is estimable. Check whether its column varies independently in the observed design. An all-zero interaction column cannot identify an interaction coefficient.
- Confusing rank deficiency with high correlation. Exact dependence makes the rank smaller than the number of columns. Near-dependence can cause unstable estimates, but it is a different diagnostic problem.
- Reading aliased coefficients as ordinary estimates. A software package may drop a column or report an undefined coefficient. Which column is omitted can depend on the computational procedure; the underlying issue is the same linear dependence.
For actuarial modeling, a redundant encoding can obscure whether a reported category effect is genuinely defined by the observed data. A rank check is therefore a useful model-design diagnostic before interpreting coefficients or communicating conclusions. Reference coding and contrast constraints are alternative parameterizations; they do not change the information in the observations or repair a missing factor combination.
This treatment of model-matrix dependence is aligned with the SOA Exam PA (Predictive Analytics) syllabus.
Check Your Understanding
For each problem, determine what the model-matrix columns imply about identifiability. Answers are included for checking.
- A factor has four observed levels. A model uses an intercept and four indicator columns. What is the dependence relation, and how many independent columns are possible if all levels occur? (Answer: The intercept equals the sum of the four indicators; rank is at most 4, not 5.)
- A two-level factor is coded with an intercept and one indicator for the non-reference level. Both levels occur. How many columns are there, and is this coding full rank? (Answer: Two columns; yes, rank 2 when both levels occur.)
- A model matrix has columns \(1,A,B,AB\), with observed rows \((0,0),(0,1),(1,0),(1,1)\). What is its rank? (Answer: 4; all columns are independent.)
- For the same four columns, suppose the only observed rows are \((0,0),(0,1),(1,0)\). Which column is zero, and what are the rank and number of columns? (Answer: \(AB\) is zero; rank 3 with 4 columns.)
- A fitted model matrix has 80 rows, 7 columns, and QR rank 6. Is the model matrix full column rank, and what does that imply about the coefficient representation? (Answer: No; one column is dependent on the others, so the coefficient vector is not uniquely identifiable without a constraint or reparameterization.)