Simulated Method of Moments -- Stochastic Volatility Model
/*----------------------------------------------------------------------
SAS Sample Library
Name: modex17.sas
Description: Example program from SAS/ETS User's Guide,
The MODEL Procedure
Title: Simulated Method of Moments -- Stochastic Volatility Model
Product: SAS/ETS Software
Keys: nonlinear simultaneous equation models
PROC: MODEL
Notes:
----------------------------------------------------------------------*/
%let nobs=1000;
data _tmpdata;
a = -0.736; b=0.9; s=0.363;
ll=sqrt( exp(a/(1-b)));;
do i=-10 to &nobs;
u = rannor( 101 );
z = rannor( 101 );
lnssq = a+b*log(ll**2) +s*u;
st = sqrt(exp(lnssq));
ll = st;
y = st * z;
if i > 0 then output;
end;
run;
title1 'Simulated Method of Moments for Stochastic Volatility Model';
proc model data=_tmpdata ;
parms a b .5 s 1;
instrument / intonly;
u = rannor( 8801 );
z = rannor( 9701 );
lsigmasq = xlag(sigmasq,exp(a));
lnsigmasq = a + b * log(lsigmasq) + s * u;
sigmasq = exp( lnsigmasq );
ysim = sqrt(sigmasq) * z;
eq.m1 = abs(y) - abs(ysim);
eq.m2 = y**2 - ysim**2;
eq.m5 = abs(y*lag(y))-abs(ysim*lag(ysim));
fit m1 m2 m5 / gmm npreobs=10 ndraw=10 adjsmmv;
bound s > 0, 1 > b > 0;
run;