[Lme4-commits] r1406 - pkg/lme4Eigen/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 27 19:35:31 CEST 2011


Author: dmbates
Date: 2011-09-27 19:35:30 +0200 (Tue, 27 Sep 2011)
New Revision: 1406

Modified:
   pkg/lme4Eigen/R/AllClass.R
   pkg/lme4Eigen/R/lmer.R
Log:
Reinstitute the Gp slot in merMod objects


Modified: pkg/lme4Eigen/R/AllClass.R
===================================================================
--- pkg/lme4Eigen/R/AllClass.R	2011-09-23 09:14:15 UTC (rev 1405)
+++ pkg/lme4Eigen/R/AllClass.R	2011-09-27 17:35:30 UTC (rev 1406)
@@ -12,7 +12,7 @@
 ## shouldn't we have "merPred"  with two *sub* classes "merPredD" and "merPredS"
 ## for the dense and sparse X cases ?
 
-merPredD <-                 # Do we need the generator object? Probably - at least while debugging
+merPredD <-
 setRefClass("merPredD", # Predictor class for mixed-effects models with dense X
             fields =
             list(
@@ -373,6 +373,7 @@
                         flist   = "list",
                         cnms    = "list",
                         lower   = "numeric",
+                        Gp      = "integer",
                         theta   = "numeric",
                         beta    = "numeric",
                         u       = "numeric",

Modified: pkg/lme4Eigen/R/lmer.R
===================================================================
--- pkg/lme4Eigen/R/lmer.R	2011-09-23 09:14:15 UTC (rev 1405)
+++ pkg/lme4Eigen/R/lmer.R	2011-09-27 17:35:30 UTC (rev 1406)
@@ -46,10 +46,7 @@
     X <- model.Matrix(form, fr, contrasts, sparse = FALSE, row.names = FALSE) ## sparseX not yet
     p <- ncol(X)
     pp <- new("merPredD", X=X, Zt=reTrms$Zt, Lambdat=reTrms$Lambdat, Lind=reTrms$Lind,
-	      theta=reTrms$theta + 1e-06) # ensure all entries of
-					# theta are nonzero because
-					# Eigen tends to prune sparse matrices
-                                        # (Probably not needed any more).
+	      theta=reTrms$theta)
     resp <- mkRespMod2(fr)
     if (REML) resp$REML <- p
 
@@ -80,7 +77,7 @@
 	     sigmaML=sqrt(pwrss/n), sigmaREML=sqrt(pwrss/(n-p)))
 
     new("lmerMod", call=mc, frame=fr, flist=reTrms$flist, cnms=reTrms$cnms,
-	theta=pp$theta, beta=pp$delb(), u=pp$delu(), lower=reTrms$lower,
+	theta=pp$theta, beta=pp$delb(), u=pp$delu(), lower=reTrms$lower, Gp=reTrms$Gp,
 	devcomp=list(cmp=cmp, dims=dims), pp=pp, resp=resp)
 }## { lmer }
 
@@ -232,8 +229,8 @@
 	     sigmaML=NA, sigmaREML=NA)
 
     new("glmerMod", call=mc, frame=fr, flist=reTrms$flist, cnms=reTrms$cnms,
-	theta=pp$theta, beta=pp$beta0, u=pp$u0, lower=reTrms$lower,
-	devcomp=list(cmp=cmp, dims=dims), pp=pp, resp=resp)
+        Gp=reTrms$Gp, 	theta=pp$theta, beta=pp$beta0, u=pp$u0,
+        lower=reTrms$lower, devcomp=list(cmp=cmp, dims=dims), pp=pp, resp=resp)
 }## {glmer}
 
 ##' Create an lmerResp, glmerResp or (later) nlmerResp instance
@@ -364,7 +361,8 @@
 					    thoff[i]))
 			     }))))
     thet <- numeric(sum(nth))
-    ll <- list(Zt = Zt, theta = thet, Lind = as.integer(Lambdat at x))
+    ll <- list(Zt=Zt, theta=thet, Lind=as.integer(Lambdat at x),
+               Gp=unname(c(0L, cumsum(nb))))
     ## lower bounds on theta elements are 0 if on diagonal, else -Inf
     ll$lower <- -Inf * (thet + 1)
     ll$lower[unique(diag(Lambdat))] <- 0



More information about the Lme4-commits mailing list