Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Successive rounds of a simulation become slower and slower


From   Joerg Luedicke <[email protected]>
To   [email protected]
Subject   Re: st: Successive rounds of a simulation become slower and slower
Date   Wed, 26 Oct 2011 16:59:01 -0400

On Wed, Oct 26, 2011 at 1:50 PM, Joerg Luedicke
<[email protected]> wrote:
> If every simulation run really does the same thing, then the
> time increase is linear.


Due to the non-absence of procrastination tendencies on my end, here
is some actual evidence, supporting the above claim:

/***********************************/
capture program drop simtime
program define simtime, rclass
clear
timer clear 1
timer on 1
qui set obs 1000
qui gen float y=rnormal()
forval i=1/20 {
	qui gen float x`i'=rnormal()
}
qui reg y x*
timer off 1
qui timer list 1
return scalar t=r(t1)
end

simulate time=r(t), reps(1000) saving(simtime1000, replace): simtime

gen run=_n
gen cumtime=time
replace cumtime=cumtime+cumtime[_n-1] if _n>1
scatter cumtime run
/***********************************/

Joerg
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index