[R] Computation efficiency with lme in looping

Gang Chen gangchen at mail.nih.gov
Fri Aug 31 22:47:07 CEST 2007

I'm running a mixed-effects model with lme in a big for loop of  
20,000 iterations. It would take from 20 to 100 hours to finish a  
typical analysis depending on the complexity of the model. However in  
the model

Y = X*beta + Z*b + e

X and Z are always the same for all the iterations, and the only  
thing that differs is Y (and the estimates of beta, b and e of  
course). So I guess there are a lot of unnecessary repetitive  
computations (matrix operations?) in the loop. How can I achieve  
higher efficiency with lme?

Thank you very much,

More information about the R-help mailing list