[R] how to make simulation faster
skarmv at gmail.com
Sat Oct 27 00:01:01 CEST 2012
Thank you very much for saving my time. I ran 500 simulations in 20 min using
"sapply" function. I'll try "data.table" method for the rest of my
simulations to get the results even faster. Thanks a lot again!
> You can get even better improvement using the 'data.table' package:
> + dt <- data.table(value = x, z = z)
> + r3 <- dt[
> + , list(sum = sum(value))
> + , keyby = z
> + ]
> + })
> user system elapsed
> 0.14 0.00 0.14
> On Thu, Oct 25, 2012 at 11:23 PM, stats12 <
> > wrote:
>> Dear R users,
>> I need to run 1000 simulations to find maximum likelihood estimates. I
>> print my output as a vector. However, it is taking too long. I am running
>> simulations at a time and it is taking me 30 minutes. Once I tried to run
>> 200 simulations at once, after 2 hours I stopped it and saw that only
>> 40 of them are simulated in those 2 hours. Is there any way to make my
>> simulations faster? (I can post my code if needed, I'm just looking for
>> general ideas here). Thank you in advance.
>> View this message in context:
>> Sent from the R help mailing list archive at Nabble.com.
> mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> Jim Holtman
> Data Munger Guru
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://r.789695.n4.nabble.com/how-to-make-simulation-faster-tp4647492p4647614.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help