Nov 4
I've been continuing simulation studies this week. I'm looking at comparisons of estimates to an SRS (we talked about this a bit last week but I got more solid data on it), percent error (looking at the number of estimates with percent errors less than 10, 5, and 1 percent), and design effect (the ratio of variance to the variance of a simple random sample with the same data).
I'm doing the simulation studies using three of the estimation methods we had talked about before, the two functions that take a scale factor and standard deviation, and the one that takes a range of scale factors.
I'm also wondering if there is a way to make the simulations faster, or if there are ways to have my computer devote more power to them. I wouldn't say that they're prohibitively slow, but it would be nice if I could get them to go a bit faster, and its something I dont really know anything about.
At first look, I don't see anything obvious in the R code
that would let you speed it up significantly.
You could try running it on another machine, which might
well be beefier - cs has R installed. I just set up
a user account for you. Use scp to move your files over,
ssh to set up an account, and "at" to start a batch job
if it's something that takes some time, so you can log
out and let it run without out. We can go over this in class. - Jim
Second answer: profiling, and vectorizing
* http://www.google.com/search?gcx=w&sourceid=chrome&ie=UTF-8&q=rprof
* http://rwiki.sciviews.org/doku.php?id=tips:programming:code_optim2
google "rprof" for the profiling (i.e. seeing what's slow)
Usually the biggest win is "vectorizing", that is,
letting R apply a function to a list rather than using a loop.
See particularly lapply and its cousins :
http://www.ats.ucla.edu/stat/r/library/advanced_function_r.htm