Page 1 of 1

Simulation of AR(1) and MA(1) model

Posted: Thu Jan 25, 2018 11:06 am
by bibhuti06
Hi,
I have no idea about how to simulate an AR(1) and MA(1) model with only the estimated value of the parameters, i.e., there is no observation, value of standard error etc. Can you guys give me any guideline about this?

Re: Simulation of AR(1) and MA(1) model

Posted: Thu Jan 25, 2018 11:27 am
by TomDoan
This will simulate a 500 observation AR(1) and MA(1) with 100 observations used as a burn-in (so the usable simulations will be from 101 to 600). Without the standard deviation of the shocks, that isn't a complete DGP, but the standard deviation only affects the scale of the generated data. If you change sigma from 1.0 to 10.0, the data will be larger by a factor of 10, so instead of running from roughly -4 to +4 (with these parameters), they'll run from around -40 to +40.

Code: Select all

compute theta=.5
compute rho=.6
compute sigma=1.0
 
compute nburn=100
compute nobs=500
*
set u 1 nburn+nobs = %ran(sigma)
set ma 1 nburn+nobs = u+theta*u{1}
set(first=0.0) ar 1 nburn+nobs = rho*ar{1}+u
*
graph 2
# ma nburn+1 nburn+nobs
# ar nburn+1 nburn+nobs
In addition, the DIEB3P148.RPF, DIEB3P156.RPF and DIEBP163.RPF (from the Diebold textbook) are examples of simulating (in order) MA(1), AR(1) and AR(2) respectively.