ciTools
ciTools copied to clipboard
Rank-deficient models in lme4 produce errors
Warning message produced by lme4::lmer
fixed-effect model matrix is rank deficient so dropping 7 columns / coefficients.
Result with add_ci/add_pi
Error in X %*% vcovBetaHat : non-conformable arguments
Likely what is happening is that lmer is taking your specified model, noticing that the covariance matrix won't properly invert, and is thus dropping some columns so that it behaves better. When ciTools tries to do the same thing, it attempts to use the original, un-reduced matrix and thus produces the above error.
Good catch! Some thoughts:
- I'm surprised lmer doesn't throw an error if the model matrix is not full rank.
- I wonder how lmer chooses which columns to drop.
- Can you provide a small reproducible example?
I have opened a new branch that addresses this bug. But now I'm wondering if we need to implement similar fixes for lm, glm, etc. 41f3c65d6e257c68dbb68d55cb4eaad3701342a1