[Lme4-commits] r1809 - pkg/lme4.0/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 17 17:34:32 CEST 2013


Author: bbolker
Date: 2013-04-17 17:34:31 +0200 (Wed, 17 Apr 2013)
New Revision: 1809

Modified:
   pkg/lme4.0/tests/lmer-1.R
   pkg/lme4.0/tests/lmer-1.Rout.save
   pkg/lme4.0/tests/nlmer.R
   pkg/lme4.0/tests/nlmer.Rout.save
   pkg/lme4.0/tests/simulate.R
Log:
test fix from Ruth Ripley; precision downgrades for tests



Modified: pkg/lme4.0/tests/lmer-1.R
===================================================================
--- pkg/lme4.0/tests/lmer-1.R	2013-04-09 23:45:28 UTC (rev 1808)
+++ pkg/lme4.0/tests/lmer-1.R	2013-04-17 15:34:31 UTC (rev 1809)
@@ -121,10 +121,10 @@
     op <- options(digits=4)
     fixef(M2.)
     cov2cor(vcov(M2.))
-    ## discrepancies have occured at digit 140.641x;
+    ## discrepancies have occured at digit 140.64x;
     ##  digits= doesn't handle it properly since other
     ##  elements have smaller magnitudes
-    round(c(unlist(VarCorr(M2.))),3)  
+    round(c(unlist(VarCorr(M2.))),2)  
     options(op)
     ## summary(M2.)
     M2  <- lmer (y ~ x + ( x | group))

Modified: pkg/lme4.0/tests/lmer-1.Rout.save
===================================================================
--- pkg/lme4.0/tests/lmer-1.Rout.save	2013-04-09 23:45:28 UTC (rev 1808)
+++ pkg/lme4.0/tests/lmer-1.Rout.save	2013-04-17 15:34:31 UTC (rev 1809)
@@ -453,12 +453,12 @@
         [,1]    [,2]
 [1,]  1.0000 -0.9961
 [2,] -0.9961  1.0000
->     ## discrepancies have occured at digit 140.641x;
+>     ## discrepancies have occured at digit 140.64x;
 >     ##  digits= doesn't handle it properly since other
 >     ##  elements have smaller magnitudes
->     round(c(unlist(VarCorr(M2.))),3)  
- group1  group2  group3  group4 
-140.641  -1.424  -1.424   0.014 
+>     round(c(unlist(VarCorr(M2.))),2)  
+group1 group2 group3 group4 
+140.64  -1.42  -1.42   0.01 
 >     options(op)
 >     ## summary(M2.)
 >     M2  <- lmer (y ~ x + ( x | group))
@@ -643,8 +643,8 @@
 > if(.unsafe.BLAS) rm(identical)
 > 
 > cat('Time elapsed: ', proc.time(),'\n') # for ``statistical reasons''
-Time elapsed:  7.204 2.836 10.664 0.012 0.096 
+Time elapsed:  5.608 1.612 7.891 0 0.024 
 > 
 > proc.time()
    user  system elapsed 
-  7.216   2.936  10.666 
+  5.608   1.636   7.892 

Modified: pkg/lme4.0/tests/nlmer.R
===================================================================
--- pkg/lme4.0/tests/nlmer.R	2013-04-09 23:45:28 UTC (rev 1808)
+++ pkg/lme4.0/tests/nlmer.R	2013-04-17 15:34:31 UTC (rev 1809)
@@ -21,10 +21,12 @@
 options(op)
 showProc.time() # ~ 5.7s {dual-opteron 2814, on 64b, no optim.}
 
+op <- options(digits=3)
 (nm3 <- nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
               (lKe|Subject) + (lKa|Subject) + (lCl|Subject),
               Theoph, start = Th.start))
 showProc.time() # ~ 3.2s
+options(op)
 
 ## dropping   lKe  from random effects:
 (nm4 <- nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~

Modified: pkg/lme4.0/tests/nlmer.Rout.save
===================================================================
--- pkg/lme4.0/tests/nlmer.Rout.save	2013-04-09 23:45:28 UTC (rev 1808)
+++ pkg/lme4.0/tests/nlmer.Rout.save	2013-04-17 15:34:31 UTC (rev 1809)
@@ -63,36 +63,38 @@
 lCl  0.671 -0.141
 > options(op)
 > showProc.time() # ~ 5.7s {dual-opteron 2814, on 64b, no optim.}
-Time elapsed:  5.432 0.012 5.456 
+Time elapsed:  4.908 0 4.899 
 > 
+> op <- options(digits=3)
 > (nm3 <- nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
 +               (lKe|Subject) + (lKa|Subject) + (lCl|Subject),
 +               Theoph, start = Th.start))
 Nonlinear mixed model fit by the Laplace approximation 
 Formula: conc ~ SSfol(Dose, Time, lKe, lKa, lCl) ~ (lKe | Subject) + (lKa |      Subject) + (lCl | Subject) 
    Data: Theoph 
-   AIC   BIC logLik deviance
- 146.1 166.3 -66.07    132.1
+ AIC BIC logLik deviance
+ 146 166  -66.1      132
 Random effects:
  Groups   Name Variance Std.Dev.
- Subject  lKe  0.000000 0.00000 
- Subject  lKa  0.227490 0.47696 
- Subject  lCl  0.015738 0.12545 
- Residual      0.591692 0.76921 
+ Subject  lKe  0.0000   0.000   
+ Subject  lKa  0.2275   0.477   
+ Subject  lCl  0.0157   0.125   
+ Residual      0.5917   0.769   
 Number of obs: 132, groups: Subject, 12
 
 Fixed effects:
     Estimate Std. Error t value
-lKe -2.47500    0.05641  -43.88
-lKa  0.47408    0.15291    3.10
-lCl -3.23538    0.05236  -61.79
+lKe  -2.4750     0.0564   -43.9
+lKa   0.4741     0.1529     3.1
+lCl  -3.2354     0.0524   -61.8
 
 Correlation of Fixed Effects:
     lKe    lKa   
 lKa -0.264       
 lCl  0.671 -0.133
 > showProc.time() # ~ 3.2s
-Time elapsed:  4.536 0.128 4.692 
+Time elapsed:  6.1 0 6.25 
+> options(op)
 > 
 > ## dropping   lKe  from random effects:
 > (nm4 <- nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
@@ -121,7 +123,7 @@
 lKa -0.264       
 lCl  0.671 -0.141
 > showProc.time()
-Time elapsed:  3.233 0.068 3.381 
+Time elapsed:  2.641 0 2.653 
 > 
 > (nm5 <- nlmer(conc ~ SSfol(Dose, Time,lKe, lKa, lCl) ~
 +               (lKa|Subject) + (lCl|Subject),
@@ -149,7 +151,7 @@
 lKa -0.264       
 lCl  0.671 -0.133
 > showProc.time()
-Time elapsed:  2.8 0.068 2.95 
+Time elapsed:  2.508 0.028 2.548 
 > 
 > e3 <- expand(nm3)
 > stopifnot(identical(sapply(e3, class),
@@ -175,8 +177,8 @@
 +           )
 > 
 > showProc.time()
-Time elapsed:  0.04 0.04 0.08 
+Time elapsed:  0.036 0.02 0.059 
 > 
 > proc.time()
    user  system elapsed 
- 19.713   2.692  23.289 
+ 18.905   1.248  20.864 

Modified: pkg/lme4.0/tests/simulate.R
===================================================================
--- pkg/lme4.0/tests/simulate.R	2013-04-09 23:45:28 UTC (rev 1808)
+++ pkg/lme4.0/tests/simulate.R	2013-04-17 15:34:31 UTC (rev 1809)
@@ -10,7 +10,7 @@
 ##' @author Ben Bolker, Feb.2011;  Martin Maechler, Aug.2011
 pboot <- function(m0,m1, nsim = 1, seed=NULL) {
   smat <- simulate(m0, nsim=nsim, seed=seed)
-  2 * apply(smat, 2, function(s) logLik(refit(m1,s)) - logLik(refit(m0,s)))
+  2 * sapply(smat, function(s) logLik(refit(m1,s)) - logLik(refit(m0,s)))
 }
 
 set.seed(54321)
@@ -44,9 +44,10 @@
 
 ## FIXME: fails on more recent R 3.0.0, maybe 2.15.3?
 ##  with downdated X'X problem ...
-## r1 <- pboot(gm0,gm1, 10)
-## showProc.time()
-## summary(r1)
+##  17 April 2013; not a problem anymore?
+r1 <- pboot(gm0,gm1, 10)
+showProc.time()
+summary(r1)
 
 
 ## FIXME: want real Poisson example, but will have to simulate one instead for now



More information about the Lme4-commits mailing list