[R] bootstap and lme4

Douglas Bates bates at stat.wisc.edu
Mon May 9 15:14:29 CEST 2005


FabbroThomas wrote:
> Hi,
> 
> I am trying to get bootstrap confidence intervals on  variance
> components and related statistics. To calculate the variance components
> I use the package lme4.
> 
>> off.fun <- function(data, i){
>   d <- data[i,]
>   lme1<- lmer(y ~ trt + (trt-1|group), d)
>   VarCorr(lme1)@reSumry$group[2,1] #just as an example
> }
>> off.boot <- boot(data=data.sim, statistic=off.fun, R=100)
> 
> If I choose small values of R (<10) then I get very reasonable results
> but for large R I get the following error massage:
> 
> 
>      *** malloc: vm_allocate(size=1069056) failed (error code=3)
>      *** malloc[682]: error: Can't allocate region
>      Error in .local(x, ...) : Calloc could not allocate (48 of 8) memory
> 
> 
> Can anyone tell me why I get this error massage and  what I can do to
> avoid this problem?
> 
> Thank you very much for your help!
> 
> Thomas
> 
> 
> 
> I am working with:
> R 2.1.0
> boot 1.2-22
> lme4 0.95-6
> Matrix 0.95-7
> lattice 0.11-6
> latticeExtra 0.1-1
> 

Could you run

traceback()

after a failure and see where the failure is occurring?

This may not have an effect but you could avoid some of the assignments
in your off.fun function.  It should work to use

off.fun <- function(data, i) VarCorr(lmer(y ~ trt + (trt - 1|group),
data, subset = i))@reSumry$group[2,1]

If that call to lmer doesn't work let me know please.




More information about the R-help mailing list