Get Started →
Modeling & Regression Errors

Singular or rank-deficient fit

Matches: (nearly )?singular fit|rank-deficient

WHAT THIS ERROR MEANS

Your model has perfect multicollinearity — some predictors are exact linear combinations of others, making the model unsolvable. This often happens with dummy variable traps or redundant features.

HOW TO FIX IT

1. Remove redundant or perfectly correlated predictors.

2. Check for dummy variable traps (drop one level of each factor).

3. Use alias() to identify which coefficients are aliased.

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
# pct_male + pct_female always = 100
lm(y ~ pct_male + pct_female, data = df)
GOOD — CORRECT APPROACH
lm(y ~ pct_male, data = df)  # drop one redundant predictor

Still stuck?

Paste your code in RChat and the AI will fix this error in context.

Try RChat Free →

RELATED MODELING & REGRESSION ERRORS