1
votes

Why is not confint.default which is based on asymptotic normality doesn't work for lmer model ?

fit <- lmer(y~(1|operator)+(1|part),data=dat)

Linear mixed model fit by REML ['lmerMod']
Formula: y ~ (1 | operator) + (1 | part)
 Data: dat
REML criterion at convergence: 409.3913
Random effects:
Groups   Name        Std.Dev.
part     (Intercept) 3.2018  
operator (Intercept) 0.1031  
Residual             0.9398  
Number of obs: 120, groups:  part, 20; operator, 3
Fixed Effects:
(Intercept)  
     22.39  


 confint.default(fit)
 Error in as.integer(x) : 
   cannot coerce type 'S4' to vector of type 'integer'

What is the error saying ? How can I get confidence interval based on asymptotic normality for lmer model ?

2

2 Answers

4
votes

Don't use confint.default(), just use confint(). The methods to calculate confidence intervals are different for the different model types. You can see the different methods with methods(confint). The "correct" version of the function is called based on the class of the first object you pass to the function. Directly calling one of the methods usually isn't a good idea.

There are options for how to calculate the bounds for the lmer objects. Look at the help page for ?confint.merMod to see the options unique to that model type.

2
votes

@MrFlick is correct, but it may be worth adding that confint.merMod() gives likelihood profile CIs by default; confint(.,method="Wald") will give the confidence intervals based on asymptotic normality:

β€˜"Wald"’: approximating the confidence intervals (of fixed-effect parameters only; all variance-covariance parameters CIs will be returned as β€˜NA’) based on the estimated local curvature of the likelihood surface;

(this is obvious from the help page, but is probably worth restating here).