Dear Helpers, I want to run GRJ-Garch model. Two versions of code I have tried:
Version 1: from the following webpage
/* Estimate GJR-GARCH Model */
proc model data = gjrgarch ;
parms arch0 .1 arch1 .2 garch1 .75 phi .1;
/* mean model */
y = intercept ;
/* variance model */
if zlag(resid.y) > 0 then
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) ;
else
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) +
phi*xlag(resid.y**2,mse.y) ;
/* fit the model */
fit y / method = marquardt fiml ;
run ;
quit ;
Version 2: I modified from what I read from the manual. "type = grjgarch"
proc autoreg data=oneCoin ;
model ret = / nlag=1 garch=(p=1, q=1, type=gjrgarch) ;
run ;
In the version 1, I understand the variable of interest is phi. But I do not know how to read the output of the Version 2. Although I read page 402 in the below manual, I do not know what shows in my below snapshot. Could you please help me understand?
https://support.sas.com/documentation/onlinedoc/ets/132/autoreg.pdf
Besides, I also wish to understand whether Version 1 and 2 are exactly the same? Thank you!
Hello @Gigiwen
In your version 1 PROC MODEL code, you specified a pure GJR-GARCH model without autoregressive errors; in your version 2 PROC AUTOREG code, you specified a GJR-GARCH model with autoregressive errors(with the NLAG = option in your code). If you intended to specify a pure GJR-GARCH model without autoregressive errors, then you may want to remove the NLAG = option in your version 2 PROC AUTOREG code.
Once you have removed the NLAG = option in your version 2 PROC AUTOREG code, then both versions specify a GJR-GARCH model without AR errors, but they are equivalent with some re-parameterization as discussed below:
In your version 1 PROC MODEL code, it specifies that:
if zlag(resid.y) > 0 then
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) ;
else
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) +
phi*xlag(resid.y**2,mse.y) ;
*Note: the resid.y is an internal variable in PROC MODEL defined as:
resid.y = pred.y - actual.y
SAS Help Center: Equation Translations
this means that resid.y in PROC MODEL is the negative of the residual usually defined in the literature(which is actual - predicted). So the variance equation in the version 1 PROC MODEL code is defined as
if epsilon_t-1 < 0 , then
h_t = arch0 + arch1*(epsilon_t-1)**2 + garch1*h_t-1 ;
else if epsilon_t-1 >=0 then
h_t = arch0 + arch1*(epsilon_t-1)**2 + garch1*h_t-1 + phi*(epsilon_t-1)**2
While in version 2 PROC AUTOREG code(after removing NLAG = 1 option from your code), the GJR-GARCH model specifies the variance equation as discussed in the following section:
h_t = omega + (alpha1 + I_{epsilon_t-1 < 0}*psi1)*(epsilon_t-1)**2 + gamma1*h_t-1
where I_{epsilon_t-1<0} is the indicator that takes the value 1 when epsilon_t-1 <0, and takes the value of 0 when epsilon_t-1 > = 0. The above variance equation is thus translated as:
if epsilon_t-1 < 0, then
h_t = omega + (alpha1 + psi1)*(epsilon_t-1)**2 + gamm1*h_t-1 ;
else if epsilon_t-1 >=0 then
h_t = omega + alpha1*(epsilon_t-1)**2 + gamma1*h_t-1 ;
Corresponding to the parameter names in PROC AUTOREG parameter estimates table,
omega = TARCHA0
alpha1 = TARCHA1
psi1 = TARCHB1
gamma1 = TGARCH1
Comparing the variance equations in the two versions, they are equivalent with the following reparameterization:
Version 1 PROC MODEL Version 2 PROC AUTOREG(after removing NLAG = option)
arch0 TARCHA0
arch1 TARCHA1 + TARCHB1
arch1 + phi TARCHA1
garch1 TGARCH1
From row 2 and row 3 above, you can see that phi and TARCHB1 is negative of each other:
phi = -TARCHB1
******************************************************
Or alternatively, you may simply modify your version 1 PROC MODEL code by reversing the variance equations between the cases zlag(resid.y) >0 and zlag(resid.y)<=0, i.e., specify the following variance equations instead:
/* variance model */
if zlag(resid.y) <= 0 then
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) ;
else
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) +
phi*xlag(resid.y**2,mse.y) ;
then the two versions will have one on one matching on all the parameters.
I hope this helps.
Wen
Hello @Gigiwen
In your version 1 PROC MODEL code, you specified a pure GJR-GARCH model without autoregressive errors; in your version 2 PROC AUTOREG code, you specified a GJR-GARCH model with autoregressive errors(with the NLAG = option in your code). If you intended to specify a pure GJR-GARCH model without autoregressive errors, then you may want to remove the NLAG = option in your version 2 PROC AUTOREG code.
Once you have removed the NLAG = option in your version 2 PROC AUTOREG code, then both versions specify a GJR-GARCH model without AR errors, but they are equivalent with some re-parameterization as discussed below:
In your version 1 PROC MODEL code, it specifies that:
if zlag(resid.y) > 0 then
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) ;
else
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) +
phi*xlag(resid.y**2,mse.y) ;
*Note: the resid.y is an internal variable in PROC MODEL defined as:
resid.y = pred.y - actual.y
SAS Help Center: Equation Translations
this means that resid.y in PROC MODEL is the negative of the residual usually defined in the literature(which is actual - predicted). So the variance equation in the version 1 PROC MODEL code is defined as
if epsilon_t-1 < 0 , then
h_t = arch0 + arch1*(epsilon_t-1)**2 + garch1*h_t-1 ;
else if epsilon_t-1 >=0 then
h_t = arch0 + arch1*(epsilon_t-1)**2 + garch1*h_t-1 + phi*(epsilon_t-1)**2
While in version 2 PROC AUTOREG code(after removing NLAG = 1 option from your code), the GJR-GARCH model specifies the variance equation as discussed in the following section:
h_t = omega + (alpha1 + I_{epsilon_t-1 < 0}*psi1)*(epsilon_t-1)**2 + gamma1*h_t-1
where I_{epsilon_t-1<0} is the indicator that takes the value 1 when epsilon_t-1 <0, and takes the value of 0 when epsilon_t-1 > = 0. The above variance equation is thus translated as:
if epsilon_t-1 < 0, then
h_t = omega + (alpha1 + psi1)*(epsilon_t-1)**2 + gamm1*h_t-1 ;
else if epsilon_t-1 >=0 then
h_t = omega + alpha1*(epsilon_t-1)**2 + gamma1*h_t-1 ;
Corresponding to the parameter names in PROC AUTOREG parameter estimates table,
omega = TARCHA0
alpha1 = TARCHA1
psi1 = TARCHB1
gamma1 = TGARCH1
Comparing the variance equations in the two versions, they are equivalent with the following reparameterization:
Version 1 PROC MODEL Version 2 PROC AUTOREG(after removing NLAG = option)
arch0 TARCHA0
arch1 TARCHA1 + TARCHB1
arch1 + phi TARCHA1
garch1 TGARCH1
From row 2 and row 3 above, you can see that phi and TARCHB1 is negative of each other:
phi = -TARCHB1
******************************************************
Or alternatively, you may simply modify your version 1 PROC MODEL code by reversing the variance equations between the cases zlag(resid.y) >0 and zlag(resid.y)<=0, i.e., specify the following variance equations instead:
/* variance model */
if zlag(resid.y) <= 0 then
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) ;
else
h.y = arch0 + arch1*xlag(resid.y**2,mse.y) + garch1*xlag(h.y,mse.y) +
phi*xlag(resid.y**2,mse.y) ;
then the two versions will have one on one matching on all the parameters.
I hope this helps.
Wen
hi, Wen, thanks for your detailed replies. Following your advise, I have change into the following:
/* Verion 1 */
proc model data = oneCoin ;
parms arch0 .1 arch1 .2 garch1 .75 phi .1;
/* mean model */
ret = intercept ;
/* variance model */
if zlag(resid.ret) <= 0 then
h.ret = arch0 + arch1*xlag(resid.ret**2,mse.ret) + garch1*xlag(h.ret,mse.ret) ;
else
h.ret = arch0 + arch1*xlag(resid.ret**2,mse.ret) + garch1*xlag(h.ret,mse.ret) +
phi*xlag(resid.ret**2,mse.ret) ;
/* fit the model */
fit ret / method = marquardt fiml ;
run ;
quit ;
/* Verion 2 */
proc autoreg data=oneCoin ;
model ret = / garch=(p=1, q=1, type=gjrgarch) ;
run ;
The output are not identical, but I guess they are close enough. Thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.