> I've made a function that executes a monte-carlo simulation.
 > It always needs a lot of time until e.g. 1Mio simulation steps are done.
 > So I would like to know, how many percent of the work is already done.


This reminds me of my 'iterator' class I was working on - but never really finished.

 Instead of doing:

 for(i in 1:10000000){
  dostuff(i)
}

which creates a vector of c(1,2,...,10000000), you create an iterator object, and do a while loop:

myLoop = loop(N=10000000)
while(iterate(myLoop)){
 dostuff(iteration(myLoop))
}

now all the information about the loop is encapsulated in the iterator object 'myLoop', and there are methods for working out when the loop might finish:

predictEnd(myLoop)

 Predicted finish at 12-Dec-02 12:12:34

I also started work on a superclass of this for MCMC runs, where you could specify a burn-in period and a sampling thinning parameter, and then there were methods for telling if you were in the burn-in period or if this was an interation that you were sampling in your output.

Maybe I'll have a go at cleaning this all up over the easter break and making a proper package of it.

Baz

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to