1. Trang chủ
  2. » Tài Chính - Ngân Hàng

SAS/ETS 9.22 User''''s Guide 130 pptx

10 229 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 264,94 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Output 18.15.1 continuedThe 2 Equations to Estimate Y = Fa1, bx, s ysq = Fa, b, s Instruments 1 x Nonlinear GMM Parameter Estimates Example 18.16: Simulated Method of Moments—AR1 Process

Trang 1

1282 F Chapter 18: The MODEL Procedure

do i=1 to 500;

x = rannor( 1013 );

Y = 2 + 1.5 * x + 1.5 * rannor( 1013 );

output;

end;

run;

proc model data=regdata;

parms a b s;

instrument x;

ysim = (a+b*x) + s * rannor( 8003 );

y = ysim;

eq.ysq = y*y - ysim*ysim;

fit y ysq / gmm ndraw;

bound s > 0;

run;

Alternatively, the MOMENT statement can be used to specify the moments using the following syntax:

proc model data=regdata;

parms a b s;

instrument x;

ysim = (a+b*x) + s * rannor( 8003 );

y = ysim;

moment y = (2);

fit y / gmm ndraw;

bound s > 0;

run;

The output of the MODEL procedure is shown inOutput 18.15.1:

Output 18.15.1 PROC MODEL Output

Simple regression model

The MODEL Procedure

Model Summary

Number of Statements 4

Model Variables Y Parameters a b s

Trang 2

Output 18.15.1 continued

The 2 Equations to Estimate

Y = F(a(1), b(x), s) ysq = F(a, b, s) Instruments 1 x

Nonlinear GMM Parameter Estimates

Example 18.16: Simulated Method of Moments—AR(1) Process

This example illustrates how to use SMM to estimate an AR(1) regression model for the following process:

yt D a C bxt C ut

ut D ˛ut 1C t

t  i id N.0; s2/

In the following SAS statements, ysim is simulated by using this model, and the endogenous variable

y is set to be equal to ysim The MOMENT statement creates two more moments for the estimation One is the second moment, and the other is the first-order autocovariance The NPREOBS=10 option instructs PROC MODEL to run the simulation 10 times before ysim is compared to the first observation of y Because the initial zlag.u/ is zero, the first ysim is aC b  x C s  rannor.8003/ Without the NPREOBS option, this ysim is matched with the first observation of y With NPREOBS, this ysim and the next nine ysim are thrown away, and the moment match starts with the eleventh ysimwith the first observation of y This way, the initial values do not exert a large influence on the simulated endogenous variables

%let nobs=500;

data ardata;

lu =0;

do i=-10 to &nobs;

x = rannor( 1011 );

e = rannor( 1011 );

u = 6 * lu + 1.5 * e;

Y = 2 + 1.5 * x + u;

lu = u;

if i > 0 then output;

end;

Trang 3

1284 F Chapter 18: The MODEL Procedure

run;

title1 'Simulated Method of Moments for AR(1) Process';

proc model data=ardata ;

parms a b s 1 alpha 5;

instrument x;

u = alpha * zlag(u) + s * rannor( 8003 );

ysim = a + b * x + u;

y = ysim;

moment y = (2) lag1(1);

fit y / gmm npreobs=10 ndraw=10;

bound s > 0, 1 > alpha > 0;

run;

The output of the MODEL procedure is shown inOutput 18.16.1:

Output 18.16.1 PROC MODEL Output

Simulated Method of Moments for AR(1) Process

The MODEL Procedure

Model Summary

Number of Statements 8 Program Lag Length 1

Model Variables Y Parameters(Value) a b s(1) alpha(0.5)

Equations _moment_2 _moment_1 Y

The 3 Equations to Estimate _moment_2 = F(a, b, s, alpha) _moment_1 = F(a, b, s, alpha)

Y = F(a(1), b(x), s, alpha) Instruments 1 x

Nonlinear GMM Parameter Estimates

Trang 4

Example 18.17: Simulated Method of Moments—Stochastic Volatility

Model

This example illustrates how to use SMM to estimate a stochastic volatility model as in Andersen and Sorensen (1996):

yt D tzt log.t2/ D a C b log.t 12 /C sut

.zt; ut/  i id N.0; I2/

This model is widely used in modeling the return process of stock prices and foreign exchange rates This is called the stochastic volatility model because the volatility is stochastic as the random variable

ut appears in the volatility equation The following SAS statements use three moments: absolute value, the second-order moment, and absolute value of the first-order autoregressive moment Note the ADJSMMV option in the FIT statement to request the SMM covariance adjustment for the parameter estimates Although these moments have closed form solution as shown by Andersen and Sorensen (1996), the simulation approach significantly simplifies the moment conditions

%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 _exog_ / 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));

Trang 5

1286 F Chapter 18: The MODEL Procedure

fit m1 m2 m5 / gmm npreobs=10 ndraw=10 adjsmmv;

bound s > 0, 1 > b > 0;

run;

The output of the MODEL procedure is shown inOutput 18.17.1

Output 18.17.1 PROC MODEL Output

Simulated Method of Moments for Stochastic Volatility Model

The MODEL Procedure

Model Summary

Number of Statements 10

Parameters(Value) a b(0.5) s(1)

Equations m1 m2 m5

The 3 Equations to Estimate

m1 = F(a, b, s) m2 = F(a, b, s) m5 = F(a, b, s) Instruments 1

Nonlinear GMM Parameter Estimates

Example 18.18: Duration Data Model with Unobserved Heterogeneity

All of the previous three models actually have closed-form moment conditions, so the simulation approach is not necessarily required for the estimation This example illustrates how to use SMM to estimate a model for which there is no closed-form solution for the moments and thus the traditional GMM method does not apply The model is the duration data model with unobserved heterogeneity

in Gourieroux and Monfort (1993):

yi D exp bxi  ui/log.vi/

ui  N.0; 1/ vi  UŒ0;1

Trang 6

The SAS statements are:

title1 'SMM for Duration Model with Unobserved Heterogeneity';

%let nobs=1000;

data durationdata;

b=0.9; s=0.5;

do i=1 to &nobs;

u = rannor( 1011 );

v = ranuni( 1011 );

x = 2 * ranuni( 1011 );

y = -exp(-b * x + s * u) * log(v);

output;

end;

run;

proc model data=durationdata;

parms b 5 s 1;

instrument x;

u = rannor( 1011 );

v = ranuni( 1011 );

y = -exp(-b * x + s * u) * log(v);

moment y = (2 3 4);

fit y / gmm ndraw=10 ;* maxiter=500;

bound s > 0, b > 0;

run;

The output of the MODEL procedure is shown inOutput 18.18.1

Output 18.18.1 PROC MODEL Output

SMM for Duration Model with Unobserved Heterogeneity

The MODEL Procedure Model Summary

Number of Statements 9

Model Variables y Parameters(Value) b(0.5) s(1)

Equations _moment_3 _moment_2 _moment_1 y

Trang 7

1288 F Chapter 18: The MODEL Procedure

Output 18.18.1 continued

The 4 Equations to Estimate

_moment_3 = F(b, s) _moment_2 = F(b, s) _moment_1 = F(b, s)

y = F(b, s) Instruments 1 x

Nonlinear GMM Parameter Estimates

Example 18.19: EMM Estimation of a Stochastic Volatility Model

The efficient method of moments (EMM), introduced by Bansal et al (1993 and 1995) and Gallant and Tauchen (2001), can be considered a variant of SMM The idea is to match the efficiency of the maximum likelihood (ML) estimation with the flexibility of the SMM procedure ML itself can be interpreted as a method of moments procedure, where the score vector, the vector of derivatives of the log-likelihood function with respect to the parameters, provides the exactly identifying moment conditions EMM employs an auxiliary (or pseudo) model that closely matches the true model The score vector of the auxiliary model provides the moment conditions in the SMM step

This example uses theSMMfeature of PROC MODEL to estimate the simple stochastic volatility (SV) model ofExample 18.17with the EMM method

Suppose that your data are the time seriesfy1; y2; : : : ; yng, and the model that you want to estimate,

or the structural model, is characterized by the vector of parameters  For the SV model,  is given

by a; b; s/

The first step of the EMM method is to fit the data with an auxiliary model (or score generator) that has transition density f ytjYt 1; /, parametrized by the pseudo parameter , where Yt 1D

fyt 1; : : : ; y1g The auxiliary model must approximate the true data-generating process as closely

as possible and be such that ML estimation is feasible

The only identification requirement is that the dimension of the pseudo parameter  be greater than

or equal to that of the structural parameter 

Andersen, Chung, and Sorensen (1999) showed that the GARCH(1,1) is an appropriate auxiliary model that leads to a good performance of the EMM estimator for the SV model

Trang 8

The analytical expression for the GARCH(1,1) model with mean zero is

yt D tzt

t2 D ! C ˛yt 1C ˇt 12

The pseudo parameter vector  is given by !; ˛; ˇ/

One advantage of such a class of models is that the conditional density of yt is Gaussian—that is,

f ytjYt 1; // 1

t exp

 yt2 2t2



Therefore the score vector can easily be computed analytically

The AUTOREG procedure provides the ML estimates, On The output is stored in thegarchoutdata set, while the estimates are stored in thegarchestdata set

title1 'Efficient Method of Moments for Stochastic Volatility Model';

/* estimate GARCH(1,1) model */

proc autoreg data=svdata(keep=y)

outest=garchest noprint covout;

model y = / noint garch=(q=1,p=1);

output out=garchout cev=gsigmasq r=resid;

run;

If the pseudo model is close enough to the structural model, in a suitable sense, Gallant and Long (1997) showed that a consistent estimator of the asymptotic covariance matrix of the sample pseudo-score vector can be obtained from the formula

OVnD 1

n

n X

t D1

sf.Yt;On/sf.Yt;On/0

where sf.Yt;On/D @=@n/ log f ytjYt 1;On/ denotes the score function of the auxiliary model computed at the ML estimates

The ML estimates of the GARCH(1,1) model are used in the following SAS statements to compute the variance-covariance matrix OVn

/* compute the V matrix */

data vvalues;

set garchout(keep=y gsigmasq resid);

/* compute scores of GARCH model */

score_1 = (-1 + y**2/gsigmasq)/ gsigmasq;

score_2 = (-1 + y**2/gsigmasq)*lag(gsigmasq) / gsigmasq;

score_3 = (-1 + y**2/gsigmasq)*lag(y**2) / gsigmasq;

array score{*} score_1-score_3;

array v_t{*} v_t_1-v_t_6;

array v{*} v_1-v_6;

Trang 9

1290 F Chapter 18: The MODEL Procedure

/* compute external product of score vector */

do i=1 to 3;

do j=i to 3;

v_t{j*(j-1)/2 + i} = score{i}*score{j};

end;

end;

/* average them over t */

do s=1 to 6;

v{s}+ v_t{s}/&nobs;

end;

run;

The OV matrix must be formatted to be used with the VDATA= option of the MODEL procedure See the section “VDATA= Input data set” on page 1158 for more information about the VDATA= data set

/* Create a VDATA dataset acceptable to PROC MODEL */

/* Transpose the last obs in the dataset */

proc transpose data=vvalues(firstobs=&nobs keep=v_1-v_6)

out=tempv;

run;

/* Add eq and inst labels */

data vhat;

set tempv(drop=_name_);

value = col1;

drop col1;

input _type_ $ eq_row $ eq_col $ inst_row $ inst_col $; *$;

datalines;

gmm m1 m1 1 1 /* intcpt is the only inst we use */

gmm m1 m2 1 1

gmm m2 m2 1 1

gmm m1 m3 1 1

gmm m2 m3 1 1

gmm m3 m3 1 1

;

The last step of the EMM procedure is to estimate  by using SMM, where the moment conditions are given by the scores of the auxiliary model

Given a fixed value of the parameter vector  and an arbitrarily large T, one can simulate a series

f Oy1./;yO2./; : : : ;yOT./g from the structural model The EMM estimator is the value On that minimizes the quantity

mT.;On/0OVn1mT.;On/

where

mT.;On/D 1

T

T X kD1

sf OYk./; On/

Trang 10

is the sample moment condition evaluated at the fixed estimated pseudo parameter On Note that the target function depends on the parameter  only through the simulated seriesyOk

The following statements generate a data set that contains T D 20; 000 replicates of the estimated pseudo parameter Onand that is then input to the MODEL procedure The EMM estimates are found

by using the SMM option of the FIT statement The OVnmatrix computed above serves as weighting matrix by using the VDATA= option, and the scores of the GARCH(1,1) auxiliary model evaluated

at the ML estimates are the moment conditions in the GMM step

Since the number of structural parameters to estimate (3) is equal to the number of moment equations (3) times the number of instruments (1), the model is exactly identified and the objective function has value zero at the minimum

For simplicity, the starting values are set to the true values of the parameters

/* USE SMM TO FIND EMM ESTIMATES */

/* Generate dataset of length T */

data emm;

set garchest(obs=1 keep = _ah_0 _ah_1 _gh_1 _mse_);

do i=1 to 20000;

output;

end;

drop i;

run;

title2 'EMM estimates';

/* Find the EMM estimates */

proc model data=emm maxiter=1000;

parms a -0.736 b 0.9 s 0.363;

instrument _exog_ / intonly;

/* Describe the structural model */

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;

/* Volatility of the GARCH model */

gsigmasq = _ah_0 + _gh_1*xlag(gsigmasq, _mse_)

+ _ah_1*xlag(ysim**2, _mse_);

/* Use scores of the GARCH model as moment conditions */

eq.m1 = (-1 + ysim**2/gsigmasq)/ gsigmasq;

eq.m2 = (-1 + ysim**2/gsigmasq)*xlag(gsigmasq, _mse_) / gsigmasq;

eq.m3 = (-1 + ysim**2/gsigmasq)*xlag(ysim**2, _mse_) / gsigmasq;

/* Fit scores using SMM and estimated Vhat */

fit m1 m2 m3 / gmm npreobs=10 ndraw=1 /* smm options */

vdata=vhat /* use estimated Vhat */

kernel=(bart,0,) /* turn smoothing off */;

Ngày đăng: 02/07/2014, 15:20

TỪ KHÓA LIÊN QUAN