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?
CIβi0.95=[^βi−1.96×SE(^βi),^βi+1.96×SE(^βi) CI 0.95 β i = [ β ^ i − 1.96 × S E ( β ^ i ) , β ^ i + 1.96 × S E ( β ^ i ) ] . Equivalently, this interval can be seen as the set of null hypotheses for which a 5% two-sided hypothesis test does not reject.
The coefficient confidence intervals provide a measure of precision for linear regression coefficient estimates. A 100(1–α)% confidence interval gives the range that the corresponding regression coefficient will be in with 100(1–α)% confidence.
Not sure when it was added, but now confint() is implemented in lme4. For example the following example works:
library(lme4) m = lmer(Reaction ~ Days + (Days | Subject), sleepstudy) confint(m)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With