NA
is occurring for confidence interval of lmer model ? How can I get rid of it ?
simfun <- function(J,n_j,g00,g10,g01,g11,sig2_0,sig01,sig2_
The problem here (which has been fixed in the development version of lme4
...) is that likelihood profiles are constructed using spline fits. If the profile is too flat, the spline fit will fail. The development version now tries to substitute linear interpolation in this case.
simfun <- function(J,n_j,g00,g10,g01,g11,sig2_0,sig01,sig2_1){
N <- sum(rep(n_j,J))
x <- rnorm(N)
z <- rnorm(J)
mu <- c(0,0)
sig <- matrix(c(sig2_0,sig01,sig01,sig2_1),ncol=2)
u <- MASS::mvrnorm(J,mu=mu,Sigma=sig)
b_0j <- g00 + g01*z + u[,1]
b_1j <- g10 + g11*z + u[,2]
y <- rep(b_0j,each=n_j)+rep(b_1j,each=n_j)*x + rnorm(N,0,sqrt(0.5))
sim_data <- data.frame(Y=y,X=x,Z=rep(z,each=n_j),
group=rep(1:J,each=n_j))
}
set.seed(102)
dat <- simfun(10,5,1,.3,.3,.3,(1/18),0,(1/18))
library("lme4") ## version 1.1-9
fit <- lmer(Y~X+Z+X:Z+(X||group),data=dat)
pp <- profile(fit,"theta_",quiet=TRUE) ## warnings
cc <- confint(pp) ## warning
## 2.5 % 97.5 %
## .sig01 0.0000000 0.2880457
## .sig02 0.0000000 0.5427609
## .sigma 0.5937762 0.8802176
You should also note that these confidence intervals are based on ML, not REML, fits ...