Page 1 of 1

Trying to extract simulations

Posted: Mon Oct 29, 2012 9:48 pm
by timduy
I am working with this simulation code:

DECLARE SERIES[VECT] HOLD
GSET HOLD ENDDATE+1 2020:4 = %ZEROS(1000,1)
DO DRAW = 1,1000
SIMULATE(MODEL=ECMODEL2,RESULTS=SIMULATION,FROM=ENDDATE+1,TO=2020:4)
*PRINT / SIMULATION(1)
DO TT = ENDDATE+1, 2020:4
COMPUTE HOLD(TT) (DRAW) = SIMULATION(1) (TT)
*WRITE HOLD(TT)
END DO TT
END DO DRAW

I would like to pull 10 of the 1000 simulated series at random (to graph as an example of possible paths). Is there a relatively simple way to do this?

Re: Trying to extract simulations

Posted: Tue Oct 30, 2012 8:26 am
by TomDoan
The easiest way to draw 10 integers without replacement from 1 to 1000 is to use BOOT:

Code: Select all

dec vect[series] samples(10)
boot(noreplace) random 1 10 1 1000
*
do i=1,10
   set samples(i) enddate+1 2020:4 = hold(t)(random(i))
end do i

Re: Trying to extract simulations

Posted: Tue Oct 30, 2012 11:39 am
by timduy
Thank you! :D