[Lme4-commits] r1779 - in pkg: lme4/R lme4/tests lme4.0 lme4.0/R lme4.0/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 25 12:08:38 CEST 2012


Author: bbolker
Date: 2012-06-25 12:08:37 +0200 (Mon, 25 Jun 2012)
New Revision: 1779

Added:
   pkg/lme4.0/tests/lmList.R
Modified:
   pkg/lme4.0/DESCRIPTION
   pkg/lme4.0/R/lmList.R
   pkg/lme4/R/lmList.R
   pkg/lme4/tests/lmList.R
Log:
 fixed bug in confint method for lmList for GLMs (reported by 'smillig'/Dieter Menne on stack overflow)
  added lmList tests to lme4.0
 version bump for lme4.0




Modified: pkg/lme4/R/lmList.R
===================================================================
--- pkg/lme4/R/lmList.R	2012-06-25 07:59:42 UTC (rev 1778)
+++ pkg/lme4/R/lmList.R	2012-06-25 10:08:37 UTC (rev 1779)
@@ -175,7 +175,8 @@
     ## the old recursive strategy doesn't work with S3 objects --
     ##  calls "confint.lmList" again instead of calling "confint"
     mCall[[1]] <- quote(confint)
-    template <- eval(mCall)
+    ## confint.glm() returns a data frame -- must cast to matrix!
+    template <- as.matrix(eval(mCall))
     val <- array(template, c(dim(template), length(object)),
                  c(dimnames(template), list(names(object))))
     pool <- list(...)$pool

Modified: pkg/lme4/tests/lmList.R
===================================================================
--- pkg/lme4/tests/lmList.R	2012-06-25 07:59:42 UTC (rev 1778)
+++ pkg/lme4/tests/lmList.R	2012-06-25 10:08:37 UTC (rev 1779)
@@ -8,6 +8,20 @@
 confint(fm1)
 fm2 <- lmList(distance ~ age | Subject, Orthodont)
 coef(fm2)
-## FIXME: add glm example?
+
+d <- data.frame(
+  g = sample(c("A","B","C","D","E"), 250, replace=TRUE),
+  y1 = runif(250, max=100),
+  y2 = sample(c(0,1), 250, replace=TRUE)
+)
+
+fm1 <- lmList(y1 ~ 1 | g, data=d)
+coef(fm1)
+confint(fm1)
+
+fm2 <- lmList(y2 ~ 1 | g, data=d, family=binomial)
+confint(fm2)
+
 ## FIXME: methods(class="lmList") shows a bunch of methods inherited from nlme
 ##    that will probably fail ... is there a way to hide these/not import them?
+

Modified: pkg/lme4.0/DESCRIPTION
===================================================================
--- pkg/lme4.0/DESCRIPTION	2012-06-25 07:59:42 UTC (rev 1778)
+++ pkg/lme4.0/DESCRIPTION	2012-06-25 10:08:37 UTC (rev 1779)
@@ -1,6 +1,6 @@
 Package: lme4.0
-Version: 0.999999-0
-Date: 2012-06-16
+Version: 0.999999-1
+Date: 2012-06-25
 Title: Linear mixed-effects models using S4 classes
 Description: Fit linear and generalized linear mixed-effects models.
     This is the implementation of lme4 available on CRAN and developed up to 2011.

Modified: pkg/lme4.0/R/lmList.R
===================================================================
--- pkg/lme4.0/R/lmList.R	2012-06-25 07:59:42 UTC (rev 1778)
+++ pkg/lme4.0/R/lmList.R	2012-06-25 10:08:37 UTC (rev 1779)
@@ -156,7 +156,7 @@
           if (length(object) < 1)
               return(new("lmList.confint", array(numeric(0), c(0,0,0))))
           mCall$object <- object[[1]]
-          template <- eval(mCall)
+          template <- as.matrix(eval(mCall))
           val <- array(template, c(dim(template), length(object)),
                        c(dimnames(template), list(names(object))))
           pool <- list(...)$pool

Added: pkg/lme4.0/tests/lmList.R
===================================================================
--- pkg/lme4.0/tests/lmList.R	                        (rev 0)
+++ pkg/lme4.0/tests/lmList.R	2012-06-25 10:08:37 UTC (rev 1779)
@@ -0,0 +1,27 @@
+data(Orthodont,package="nlme")
+Orthodont <- as.data.frame(Orthodont)
+library(lme4.0)
+fm1 <- lmList(Reaction ~ Days | Subject, sleepstudy)
+fm1 <- lmList(Reaction ~ Days | Subject, sleepstudy, pool=TRUE)
+coef(fm1)
+summary(fm1)
+confint(fm1)
+fm2 <- lmList(distance ~ age | Subject, Orthodont)
+coef(fm2)
+
+d <- data.frame(
+  g = sample(c("A","B","C","D","E"), 250, replace=TRUE),
+  y1 = runif(250, max=100),
+  y2 = sample(c(0,1), 250, replace=TRUE)
+)
+
+fm1 <- lmList(y1 ~ 1 | g, data=d)
+coef(fm1)
+confint(fm1)
+
+fm2 <- lmList(y2 ~ 1 | g, data=d, family=binomial)
+confint(fm2)
+
+## FIXME: methods(class="lmList") shows a bunch of methods inherited from nlme
+##    that will probably fail ... is there a way to hide these/not import them?
+



More information about the Lme4-commits mailing list