[R] (lme4: lmer) mcmcsamp: Error in if (var(y) == 0)

David Reitter dreitter at inf.ed.ac.uk
Thu Jan 24 09:40:15 CET 2008


I've got a problem with "mcmcsamp" used with glmer objects produced  
with "lmer" from the lme4 package.

When calling mcmcsamp, I get the error

Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed

This does not occur with all models, but I can't find anything wrong  
with the dataset.

If the error is in my data, can someone tell me what I am looking for?
(Can I print the source code of the mcmcsamp method for glmer objects?  
I'd like to know what "y" stands for.)

Many thanks for your advice!

===

 > sessionInfo()
R version 2.6.1 (2007-11-26)
i686-pc-linux-gnu

locale:
LC_CTYPE 
= 
en_GB 
.UTF 
-8 
;LC_NUMERIC 
= 
C 
;LC_TIME 
= 
en_GB 
.UTF 
-8 
;LC_COLLATE 
= 
en_GB 
.UTF 
-8 
;LC_MONETARY 
= 
en_GB 
.UTF 
-8 
;LC_MESSAGES 
= 
en_GB 
.UTF 
-8 
;LC_PAPER 
= 
en_GB 
.UTF 
-8 
;LC_NAME 
= 
C 
;LC_ADDRESS 
=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] languageR_0.4     coda_0.13-1       lme4_0.99875-9     
Matrix_0.999375-4
[5] zipfR_0.6-0       lattice_0.17-2

loaded via a namespace (and not attached):
[1] grid_2.6.1      rcompgen_0.1-17


 >    emnlp.m1 <- lmer(primed ~ (role * derivation)/(log(dist.time) *  
log(rule.freq)) + (1 + log(dist.time) | target.utt), family=binomial,  
data=data.utts )
 > summary(emnlp.m1)
Error: cannot allocate vector of size 120.3 Mb
 > emnlp.m1
Generalized linear mixed model fit using Laplace
Formula: primed ~ (role * derivation)/(log(dist.time) *  
log(rule.freq)) +      (1 + log(dist.time) | target.utt)
    Data: data.utts
  Family: binomial(logit link)
      AIC     BIC  logLik deviance
  1145907 1146131 -572935  1145869
...
                                                 Pr(>|z|)
...
rolei:derivationI:log(dist.time)                 < 2e-16 ***
roler:derivationI:log(dist.time)                 < 2e-16 ***
rolei:derivationN:log(dist.time)                 < 2e-16 ***
roler:derivationN:log(dist.time)                0.000187 ***
...
 > class(emnlp.m1)
[1] "glmer"
attr(,"package")
[1] "lme4"
 > mc <- mcmcsamp(emnlp.m1)
 > summary(mc)
Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed
Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed
Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed
Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed
Error in if (var(y) == 0) { : missing value where TRUE/FALSE needed
...
2. Quantiles for each variable:
                                                     Mean SD Naive SE
(
rolei:derivationI:log(dist.time)                -2.19615 NA       NA
roler:derivationI:log(dist.time)                -1.36876 NA       NA
...
                                                     2.5%       
25%      50%
rolei:derivationI:log(dist.time)                -2.19615 -2.19615  
-2.19615
roler:derivationI:log(dist.time)                -1.36876 -1.36876  
-1.36876

 > traceback()
11: asMethod(object)
10: as(object, superClass)
9: validityMethod(as(object, superClass))
8: identical(x, TRUE)
7: anyStrings(validityMethod(as(object, superClass)))
6: validObject(.Object)
5: initialize(value, ...)
4: initialize(value, ...)
3: new(if (is(object, "glmer")) "summary.glmer" else {
        if (is(object, "lmer"))
            "summary.lmer"
        else "summary.mer"
    }, object, isG = glz, methTitle = methTitle, logLik = llik, ngrps  
= sapply(object at flist,
        function(x) length(levels(x))), sigma = .Call(mer_sigma,
        object, REML), coefs = coefs, vcov = vcov, REmat = REmat,
        AICtab = AICframe)
2: summary(emnlp.m1)
1: summary(emnlp.m1)


--
David Reitter
ICCS/HCRC, Informatics, University of Edinburgh
http://www.david-reitter.com



More information about the R-help mailing list