On Tue, 6 Jul 2004 09:02:26 -0400, Liaw, Andy <[EMAIL PROTECTED]> wrote:
Since you didn't provide an example of what z.trun and breaks may look like, most people can only guess. Before asking how code can be made more
efficient, it might be more helpful to find out where in the code is taking
time. Try:
Rprof() obs <- table(cut2(z.trun, cuts=breaks)) Rprof(NULL) summaryRprof()
Thanks, Andy. That helped to clear up some of my confusion. I have now eliminated the call to cut2 and table and replaced that with hist, as suggested by Roger Peng.
However I had changed much more code than I had initially realised and it seems that the other code is having a larger effect. I've attached the output of an experiment (a power test with 1000 iterations - code included) and it seems that the problem is getting the expected number of observations in each cell. I have to integrate the density that I am working with in order to do this as it isn't standard.
I know that, firstly, using a for() loop is bad but the problem didn't lend itself to vectorisation (I thought). Any help would be appreciated.
-- SC
Simon Cullen Room 3030 Dept. Of Economics Trinity College Dublin
Ph. (608)3477 Email [EMAIL PROTECTED]
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
