[R-sig-ME] lmer() fit

Ben Bolker bbolker at gmail.com
Tue May 17 21:43:07 CEST 2016


  This doesn't seem like a big deal.  The following fit takes about 4.5
seconds on my Macbook Pro.

library(lme4)
set.seed(101)
nRE <- 20000
nobs <- 250000
dd <- data.frame(f=sample(1:nRE,size=nobs,replace=TRUE),
                 x=rnorm(nobs))
dd$y <- simulate(~x+(1|f),
         newparams=list(beta=c(1,2),theta=1,sigma=1),
         newdata=dd,
         family=gaussian,
         seed=102)[[1]]
system.time(fit <- lmer(y~x+(1|f),
              data=dd))
fixef(fit)
VarCorr(fit)


   If you have lots of fixed effects or very complex random effects,
things could get a bit slower.  If you have a *much* bigger problem than
this -- or if you're going to want to this sort of thing thousands of
times in a row and 4.5 seconds is too slow -- you might want to talk to
Doug Bates about the MixedModels package for Julia ...


On 16-05-17 02:23 PM, Chaitanya Acharya wrote:
> Hi, Apologies for a very non-specific question. Any idea how many
> random effects could lmer() reasonably fit? I am thinking of a
> situation where I want to fit ~20k random effects with ~250k
> observations. What kind of issues should I foresee?
> 
> Thanks, Chuck _______________________________________________ 
> R-sig-mixed-models at r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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