ciTools icon indicating copy to clipboard operation
ciTools copied to clipboard

Rank-deficient models in lme4 produce errors

Open matthewravery opened this issue 6 years ago • 2 comments

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.

matthewravery avatar Feb 12 '18 19:02 matthewravery

Good catch! Some thoughts:

  1. I'm surprised lmer doesn't throw an error if the model matrix is not full rank.
  2. I wonder how lmer chooses which columns to drop.
  3. Can you provide a small reproducible example?

jthaman avatar Feb 12 '18 20:02 jthaman

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

jthaman avatar Feb 18 '18 23:02 jthaman