[Lme4-commits] r1761 - in pkg/lme4: R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 1 13:26:02 CEST 2012


Author: bbolker
Date: 2012-06-01 13:26:01 +0200 (Fri, 01 Jun 2012)
New Revision: 1761

Modified:
   pkg/lme4/R/lmer.R
   pkg/lme4/tests/simulate.R
Log:

  evaluate family properly if it's a 'language' object
(i.e. if link is specified; reported by Pierre Morel)



Modified: pkg/lme4/R/lmer.R
===================================================================
--- pkg/lme4/R/lmer.R	2012-05-31 19:48:01 UTC (rev 1760)
+++ pkg/lme4/R/lmer.R	2012-06-01 11:26:01 UTC (rev 1761)
@@ -1329,6 +1329,7 @@
 	      if(is.character(family))
 		  family <- get(family, mode = "function", envir = parent.frame(2))
 	      if(is.function(family)) family <- family()
+              if(is.language(family)) family <- eval(family)
 	      if(is.null(family$family)) stop("'family' not recognized")
 	      musim <- family$linkinv(etasim)
 	      ntot <- length(musim) ## FIXME: or could be dims["n"]?

Modified: pkg/lme4/tests/simulate.R
===================================================================
--- pkg/lme4/tests/simulate.R	2012-05-31 19:48:01 UTC (rev 1760)
+++ pkg/lme4/tests/simulate.R	2012-06-01 11:26:01 UTC (rev 1761)
@@ -10,6 +10,10 @@
 s2 <- simulate(gm2,seed=101)[[1]]
 stopifnot(all.equal(s1[,1]/rowSums(s1),s2))
 
+gm3 <- glmer(cbind(incidence, size - incidence) ~ period +
+             (1 | herd), data = cbpp, family = binomial(link="logit"))
+s3 <- simulate(gm3,seed=101)[[1]]
+stopifnot(all.equal(s3,s1))
 ## Bernoulli
 ## works, but too slow
 if (FALSE) {



More information about the Lme4-commits mailing list