In lm
and glm
models, I use functions coef
and confint
to achieve the goal:
m = lm(resp ~ 0 + var1 + var1:var2) # var1 categorical, var2 continuous
coef(m)
confint(m)
Now I added random effect to the model - used mixed effects models using lmer
function from lme4 package. But then, functions coef
and confint
do not work any more for me!
> mix1 = lmer(resp ~ 0 + var1 + var1:var2 + (1|var3))
# var1, var3 categorical, var2 continuous
> coef(mix1)
Error in coef(mix1) : unable to align random and fixed effects
> confint(mix1)
Error: $ operator not defined for this S4 class
I tried to google and use docs but with no result. Please point me in the right direction.
EDIT: I was also thinking whether this question fits more to https://stats.stackexchange.com/ but I consider it more technical than statistical, so I concluded it fits best here (SO)... what do you think?
?lmer
lists methodsfixef
andranef
in addition tocoef
. Since your error says it's having trouble combining the two, the issue is likely that your model specification is somehow "unusual". – Cuttievar1
is categorical and I want "group specific intercepts" for each its category. If I allow the intercept (remove0 +
from formula),coef
runs but doesn't give what I expect.fixef
works great, thanks! However theconfint
doesn't work at all. – Quinbycoef
in the r-forge versions of lme4 (lme4.0, the currently stable branch which corresponds to CRAN-lme4), and lme4, the development branch).confint
is a bigger can of worms, as has been discussed, although the development branch of lme4 can calculate profile confidence intervals ... – Considerate