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.

Trying to extract simulations

Postby timduy » Mon Oct 29, 2012 9:48 pm

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?
timduy
 
Posts: 4
Joined: Sun Jan 15, 2012 1:24 am

Re: Trying to extract simulations

Postby TomDoan » Tue Oct 30, 2012 8:26 am

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
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Trying to extract simulations

Postby timduy » Tue Oct 30, 2012 11:39 am

Thank you! :D
timduy
 
Posts: 4
Joined: Sun Jan 15, 2012 1:24 am


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 0 guests