-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rank-deficient models #74
Comments
Follow-up: It turns out I already had code to figure out where to fill-in the PS -- there was a glitch in the code for |
Hi Russell -- thanks for the suggestion. I am just coming back to the office from a 5-week absence due to conferences and holidays. It will take me a while to get back to this, but will respond when I find the time. |
Classification:
Enhancement suggestion
Summary
An emmeans user posted a question about
emmprep
whereby he wasn't able to useemmprep()
for a model because it had nested fixed effects, and that caused rank deficiencies in the model.Reproducible Example (if applicable)
Created on 2023-07-22 with reprex v2.0.2
Created on 2023-07-22 with reprex v2.0.2
Notes
The emmeans package is capable of supporting rank-deficient models. However, it needs information about which predictors were dropped. That information is also useful to some users. With some small changes in the object created it would be possible to enable that support and take advantage of emmeans's ability to handle those cases rather than just issuing an error message.
The conventional way to handle rank deficiencies is the way
lm()
does it. The cofficients for all the predictors are returned bycoef()
, and the ones that are dropped are given the valueNA
. Thevcov()
function, on the other hand, just returns the covariances for the included predictors. Note in the confidence intervals forRG
(the reference grid forLM
), we were able to identify the non-estimable case (the cell that was empty). It would seem that ifrma()
also returned theNA
s as coefficients for the dropped predictors, that is all it would take, as theqdrg()
function can figure this stuff out too).One point of common confusion (or at least to me, a number of years ago): The
NA
coefficients do not actually represent missing values! Instead, they represent coefficients that were set to zero. This is clear as soon as you make the connection that dropping a predictor is the same thing as setting its coefficient to zero. When there are rank deficiencies, the solution to the normal equations is not unique; and in R, the particular solution returned is the one with those constraints to zero. There are many other valid solutions, and most of them give non-zero weight to those predictors. So we really are not saying that the dropped predictors are unimportant -- just that we didn't use them for this one particular solution.sessionInfo()
The text was updated successfully, but these errors were encountered: