You should profile (Rprof) your code to see where it is spending it time;
this will point you to what needs to be optimized.

On Wed, May 12, 2010 at 3:34 PM, Jack Siegrist <jack...@eden.rutgers.edu>wrote:

>
> 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.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to