[R-sig-ME] Does lmer have it's own random number generator?

Mike Lawrence Mike.Lawrence at dal.ca
Mon Jan 3 15:53:03 CET 2011


Using a variant of Thierry's code I get rather different results on my
machine (MacBookPro7,1, OS 10.6.5; see also sessionInfo() results
below). The modification I made simply puts call to set.seed() within
each loop of replicate(). I observe the same behaviour no matter
whether I apply this modification or not, but I wanted to highlight
lmer's insensitivity (on my machine) to the seed:

> library(ez)
> data(ANT)
>
> tmp <- replicate(100, {
+ 	set.seed(1)
+ 	fit <- lmer(
+ 		formula = rt ~ (1|subnum) +
+ 			cue*flank*group*block +
+ 			cue*flank*group*I(block^2) +
+ 			cue*flank*group*I(block^3)
+ 		, data = ANT[ANT$error==0,]
+ 	)
+ 	fit at deviance
+ })
>
> apply(tmp, 1, var, na.rm = T)
          ML         REML         ldL2        ldRX2
1.103807e-01 5.612587e-02 1.159465e+00 1.190199e-02
     sigmaML    sigmaREML        pwrss         disc
1.309610e-05 1.334286e-05 3.593904e+06 9.197845e+06
        usqr         wrss          dev         llik
1.293124e+06 9.198576e+06           NA           NA
     NULLdev
          NA
>
> apply(tmp, 1, function(x){mean(is.finite(x))})
       ML      REML      ldL2     ldRX2   sigmaML sigmaREML
      0.9       0.9       0.9       0.9       0.9       0.9
    pwrss      disc      usqr      wrss       dev      llik
      0.9       0.9       0.9       0.9       0.0       0.0
  NULLdev
      0.0
>
> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_CA.UTF-8/en_US.UTF-8/C/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] grid      splines   stats     graphics  grDevices utils
datasets  methods   base

other attached packages:
 [1] ez_2.1-0           lme4_0.999375-37   Matrix_0.999375-45
lattice_0.19-13    stringr_0.4        ggplot2_0.8.8
 [7] proto_0.3-8        reshape_0.8.3      plyr_1.2.1
car_2.0-6          survival_2.36-1    nnet_7.3-1
[13] MASS_7.3-8

loaded via a namespace (and not attached):
[1] nlme_3.1-97   stats4_2.12.0 tools_2.12.0




More information about the R-sig-mixed-models mailing list