[R-sig-ME] Confidence intervals for effects in glmer()

Robert A LaBudde ral at lcfltd.com
Tue Jun 9 15:15:08 CEST 2009


At 05:57 AM 6/9/2009, CL Pressland wrote:
>Dear fellow novice,
>
>I've used mcmc to estimate confidence intervals in lme4. You don't 
>need the coda package as it's included in lme4 now. For you it would 
>look like this:
>
>fit4.mcmc<-mcmcsamp(fit4, n=1000) #or whatever resample number you 
>think is appropriate
>HPDinterval(fit4.mcmc)  #this will fit to alpha 0.05 as default.
>
>As far as I am aware this is a fairly good method of estimating CIs 
>in mixed models, but Ben are you saying that there may be issues 
>with this process?
>
>Kate

This method doesn't work in R 2.9.0:

 > eg<- read.table('example10.txt', header=TRUE)
 > eg$lab<- as.factor(eg$lab)
 > head(eg)
   lab x
1   1 1
2   1 1
3   1 1
4   1 1
5   1 0
6   1 0
 > require('lme4')
 > fit4<- glmer(x ~ 1 + 1|lab, data=eg, nAGQ=5, family='binomial') 
#random glm model
 > summary(fit4)
Generalized linear mixed model fit by the adaptive Gaussian Hermite 
approximation
Formula: x ~ 1 + 1 | lab
    Data: eg
    AIC   BIC logLik deviance
  172.4 177.9 -84.18    168.4
Random effects:
  Groups Name        Variance Std.Dev.
  lab    (Intercept) 0.26994  0.51956
Number of obs: 120, groups: lab, 10

Fixed effects:
             Estimate Std. Error z value Pr(>|z|)
(Intercept)   0.1092     0.2477  0.4407     0.66
 > ranef(fit4)
$lab
    (Intercept)
1  -0.34766672
2  -0.34766672
3  -0.34766672
4  -0.04884925
5   0.40349845
6  -0.19803677
7  -0.04884925
8   0.71656475
9  -0.04884925
10  0.25117156

 > HPDinterval(mcmcsamp(fit4, n=1000))
Error in .local(object, n, verbose, ...) : Update not yet written
Error in HPDinterval(mcmcsamp(fit4, n = 1000)) :
   error in evaluating the argument 'object' in selecting a method 
for function 'HPDinterval'

The problem is with mcmcsamp(), which generates the "update not yet 
written" error message.


================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"




More information about the R-sig-mixed-models mailing list