Trying to extract simulations

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Trying to extract simulations

Unread post 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?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Trying to extract simulations

Unread post 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
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Trying to extract simulations

Unread post by timduy »

Thank you! :D
Post Reply