[Lme4-commits] r1704 - in pkg/lme4: . testsx
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Apr 11 02:31:30 CEST 2012
Author: bbolker
Date: 2012-04-11 02:31:30 +0200 (Wed, 11 Apr 2012)
New Revision: 1704
Added:
pkg/lme4/testsx/
pkg/lme4/testsx/colonizer_rand.RData
pkg/lme4/testsx/randcrabdata.RData
pkg/lme4/testsx/testcolonizer.R
pkg/lme4/testsx/testcrab.R
Log:
new tests (not run routinely)
Added: pkg/lme4/testsx/colonizer_rand.RData
===================================================================
(Binary files differ)
Property changes on: pkg/lme4/testsx/colonizer_rand.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/lme4/testsx/randcrabdata.RData
===================================================================
(Binary files differ)
Property changes on: pkg/lme4/testsx/randcrabdata.RData
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: pkg/lme4/testsx/testcolonizer.R
===================================================================
--- pkg/lme4/testsx/testcolonizer.R (rev 0)
+++ pkg/lme4/testsx/testcolonizer.R 2012-04-11 00:31:30 UTC (rev 1704)
@@ -0,0 +1,15 @@
+library(lme4.0)
+load("colonizer_rand.RData")
+m1 <- glmer(form1,data=randdat,
+ family=poisson)
+m2 <- glmer(form2,data=randdat,
+ family=poisson)
+detach("package:lme4.0")
+library(lme4)
+try(m1 <- glmer(form1,data=randdat,
+ family=poisson,verbose=10L))
+try(m1 <- glmer(form1,data=randdat,
+ family=poisson,verbose=10L,tolPwrss=1e-13))
+try(m2 <- glmer(form2,data=randdat,
+ family=poisson,verbose=10L))
+
Added: pkg/lme4/testsx/testcrab.R
===================================================================
--- pkg/lme4/testsx/testcrab.R (rev 0)
+++ pkg/lme4/testsx/testcrab.R 2012-04-11 00:31:30 UTC (rev 1704)
@@ -0,0 +1,42 @@
+load("randcrabdata.RData")
+## randdata0: simulated data, in form suitable for plotting
+## randdata: simulated data, in form suitable for analysis
+
+fr ## alive/dead formula
+fr2 ## proportion alive formula (use with weights=initial.snail.density)
+
+library(ggplot2)
+library(grid)
+zmargin <- opts(panel.margin=unit(0,"lines"))
+theme_update(theme_bw())
+g1 <- ggplot(randdata0,aes(x=snail.size,y=surv,colour=snail.size,fill=snail.size))+
+ geom_hline(yintercept=1,colour="black")+
+ stat_sum(aes(size=factor(..n..)),alpha=0.6)+
+ facet_grid(.~ttt)+zmargin+
+ geom_boxplot(fill=NA,outlier.colour=NULL,outlier.shape=3)+ ## set outliers to same colour as points
+ ## (hard to see which are outliers, but it doesn't really matter in this case)
+ scale_size_discrete("# obs",range=c(2,5))
+
+
+library(lme4)
+if (packageVersion("lme4")>"0.999375-42") {
+ ## using development lme4 ...
+ try(glmer1 <- glmer(fr2,weights=initial.snail.density,family ="binomial", data=randdata))
+ try(glmer1B <- glmer(fr,family ="binomial", data=randdata))
+ if (require("lme4.0")) {
+ detach("package:lme4")
+ ## prop/weights formulation
+ glmer1 <- glmer(fr2,weights=initial.snail.density,family ="binomial", data=randdata)
+ ## alive/dead formulation
+ glmer1B <- glmer(fr,family ="binomial", data=randdata)
+ }
+} else {
+ ## CRAN version of lme4
+ glmer1 <- glmer(fr2,weights=initial.snail.density,family ="binomial", data=randdata)
+ glmer1B <- glmer(fr,family ="binomial", data=randdata)
+}
+
+fixef(glmer1)
+fixef(glmer1B)
+## note in this case that variances are not converging to zero
+VarCorr(glmer1)
More information about the Lme4-commits
mailing list