[Lme4-commits] r1632 - in pkg/lme4.0: R tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 29 15:28:07 CET 2012
Author: bbolker
Date: 2012-02-29 15:28:07 +0100 (Wed, 29 Feb 2012)
New Revision: 1632
Added:
pkg/lme4.0/tests/getME.R
Modified:
pkg/lme4.0/R/lmer.R
Log:
added getME(.,"theta")
Modified: pkg/lme4.0/R/lmer.R
===================================================================
--- pkg/lme4.0/R/lmer.R 2012-02-29 13:51:51 UTC (rev 1631)
+++ pkg/lme4.0/R/lmer.R 2012-02-29 14:28:07 UTC (rev 1632)
@@ -2378,7 +2378,20 @@
"Lambda"=, ## from object at L ??
"Lambdat"=,
- "theta"=,
+ "theta"= {
+ mnames <- function(z) {
+ v <- colnames(z)
+ m <- outer(v,v,paste,sep=".")
+ diag(m) <- v
+ m[lower.tri(m,diag=TRUE)]
+ }
+ n <- unname(c(unlist(mapply(function(g,v) {
+ paste(g,mnames(v),sep=".")
+ },names(object at flist),object at ST))))
+ x <- c(sapply(object at ST,function(z) z[lower.tri(z,diag=TRUE)]))
+ names(x) <- n
+ x
+ },
"..foo.." =# placeholder!
stop(gettextf("'%s' is not implemented yet",
sprintf("getME(*, \"%s\")", name))),
Added: pkg/lme4.0/tests/getME.R
===================================================================
--- pkg/lme4.0/tests/getME.R (rev 0)
+++ pkg/lme4.0/tests/getME.R 2012-02-29 14:28:07 UTC (rev 1632)
@@ -0,0 +1,14 @@
+## tests of getME: are names correct?
+
+library(lme4.0)
+fm1 <- lmer(diameter ~ (1|plate) + (1|sample), Penicillin)
+getME(fm1,"beta")
+getME(fm1,"theta")
+
+fm2 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), cake)
+getME(fm2,"beta")
+getME(fm2,"theta")
+
+getME(lmer(Reaction ~ Days + (Days|Subject), sleepstudy),"theta")
+getME(lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),
+ sleepstudy),"theta")
More information about the Lme4-commits
mailing list