[R] vectorize a power analysis?

Jack Siegrist jacksie at eden.rutgers.edu
Wed May 12 21:34:23 CEST 2010


We are doing a power analysis by generating noisy data sets according to a
model, fitting the model to the data, and extracting a p-value. What is the
best way to do this many times? We are just using for loops and it is too
slow because we are repeating the analysis for many parameterizations. I can
think of several ways to do this:

for loop
sapply
using the plyr package
using the lme4 package

Someone told me that the apply functions are barely any faster than for
loops, so what is the best way, in general, to approach this type of problem
in R-style?
Could someone point to a discussion of the comparative time efficiencies of
these and other appropriate methods?  

I'm not looking for specific code, just sort of a list of the common
approaches with information about efficiency.

Thanks,

Jack
-- 
View this message in context: http://r.789695.n4.nabble.com/vectorize-a-power-analysis-tp2196647p2196647.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list