Bayman, Emine Ozgur
2007-Sep-25 20:02 UTC
[R] R lmer with problem of 'sd slot has negative entries'
Dear R Users, I want to fit GLMM with lmer with binomial data and a one-way random effects model with an overall mean and random effects. From R help, Laplace is slower than PQL, but more accurate. When I fit my model with Laplace method with control = list (usePQL = FALSE)), for most data sets it works well, but for some I get an error message (Error in if (any(sd < 0)) return("'sd' slot has negative entries") : missing value where TRUE/FALSE needed) In these cases I get an estimate for the fixed effect but do not get an estimate for se.fixef. If I change the method to PQL or change control = list (usePQL = TRUE) then I get estimates for both fixed effect and se.fixef, but in the example below the estimates of fixed effects are different for 3 of 4 cases. Could someone please help me? Which, if any, of the estimates for the intercept is the best one? And why are they different? I think the error occurs because the MLE for the between group variance is zero and somehow the estimate becomes negative. I appreciate any help. Thanks, Emine install.packages("nlme") install.packages("Matrix") install.packages("lme4") install.packages("car") library(nlme) library(Matrix) library(lme4) library(car) library(arm) y <- c(14, 9, 19, 12, 10, 12, 8, 11, 15, 4, 14, 13, 8, 3) n <- c( 20, 20, 20, 20, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18) center <- seq(1:14) example1 <- lmer(cbind( y, n - y) ~ 1 + ( 1 | center) , family = binomial, niter = 50, method = "Laplace", control = list (usePQL = FALSE)) fixef(example1) se.fixef(example1) example2 <- lmer(cbind( y, n - y) ~ 1 + ( 1 | center) , family = binomial, niter = 50, method = "Laplace", control = list (usePQL = TRUE)) fixef(example2) se.fixef(example2) example3 <- lmer(cbind( y, n - y) ~ 1 + ( 1 | center) , family = binomial, niter = 50, method = "PQL",control = list (usePQL TRUE)) fixef(example3) se.fixef(example3) example4 <- lmer(cbind( y, n - y) ~ 1 + ( 1 | center) , family = binomial, niter = 50, method = "PQL",control = list (usePQL FALSE)) fixef(example4) se.fixef(example4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Emine Ozgur BAYMAN PhD Student Department of Biostatistics, College of Public Health, University of Iowa Office: 2400D UCC, Iowa City / IA Office Phone: (319) 384 27 52 e-mail: emine-unlu@uiowa.edu [[alternative HTML version deleted]]