Trying to extract simulations
Trying to extract simulations
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?
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
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