*
* GARCHMVSIMULATE.RPF
* Example of simulation of a multivariate (DVECH) GARCH process
*
compute nobs=500
compute n=2
*
all nobs
*
* u is the simulated GARCH process
*
dec vect[series] u(n)
*
* H is the series of variance matrices, UU is the series of lagged outer
* products of the residuals.
*
dec series[symm] h uu
dec symm vc(n,n) va(n,n) vb(n,n)
compute vc=||.05|.01,.05||
compute va=||.05|.05,.05||
compute vb=||.90|.85,.90||
*
* Compute the stationary covariance matrix. (Because this is a DVECH,
* this can be done element by element).
*
dec symm h0(n,n)
ewise h0(i,j)=vc(i,j)/(1-va(i,j)-vb(i,j))
*
dec frml[symm] hf hu
dec symm hx
dec vect ux
*
frml hf = vc+va.*uu{1}+vb.*h{1}
frml hu = hx=hf,ux=%ranmvnormal(%decomp(hx)),uu=%outerxx(ux),%pt(u,t,ux),hx
*
* Initialize the UU and H series for the pre-sample values
*
gset uu = h0
gset h = h0
*
* Generate starting in entry 2.
*
gset h 2 500 = hu(t)
*
* Graph the series and variance series
*
graph(footer="First simulated series")
# u(1)
graph(footer="Second simulated series")
# u(2)
set h11 = h(t)(1,1)
graph(footer="Simulated variance for first series")
# h11