Re: [R] Simulation Progress

2005-02-25 Thread Barry Rowlingson

  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:1000){
  dostuff(i)
}
 which creates a vector of c(1,2,...,1000), you create an iterator 
object, and do a while loop:

myLoop = loop(N=1000)
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
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Simulation Progress

2005-02-25 Thread Gorjanc Gregor
Hi!

What about use of %%, so you print every nth iteration on screen, you can
afcoures calculate how many % of iterations has already passed etc.

Some dummy example:

i - 0
x - 1:100
for (i in x) {
if (i %% 100 == 0) {
print(i)
}
}

--
Lep pozdrav / With regards,
Gregor GORJANC


University of Ljubljana
Biotechnical Faculty   URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Departmentemail: gregor.gorjanc at bfro.uni-lj.si
Groblje 3  tel: +386 (0)1 72 17 861
SI-1230 Domzalefax: +386 (0)1 72 17 888
Slovenia



Date: Fri, 25 Feb 2005 01:51:30 +0100
From: Carsten Steinhoff [EMAIL PROTECTED]
Subject: [R] Simulation Progress
To: r-help@stat.math.ethz.ch
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain;   charset=us-ascii

Hi,

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.

In an Excel/VBA Solution I could easily implement a status bar or status
window.

How could an R-Solution look like?

Carsten

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Simulation Progress

2005-02-24 Thread Philippe Grosjean
Carsten Steinhoff wrote:
 Hi,

 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.

 In an Excel/VBA Solution I could easily implement a status bar or status
 window.

 How could an R-Solution look like?

 Carsten
I think that progress() in svMisc package (bundle SciViews on CRAN) will 
make what you are looking for: it displays progression right in the console.
Best,

Philippe Grosjean
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html