BookmarkSubscribeRSS Feed
ZhaoJin
Calcite | Level 5

     I want to estimate a GARCH-GJR model and get the estimated parameters and their variance-covariance matrix. 

     The main estimation part of the code is presentes below. I just specified a standard GJR model and estimated by "proc model" procedure, and get the varcov matrix in out1.

      However, although the model is succefully converged and there is not any warnings or errors in log (as posted), the variance-covvariance matrix in out1 has negative variance element. As show in the dateset screenshot, for the data of FX_Australia in 1970s, the variance of a1 is -6.648735E-6, which is negative.  And there is not any warnings or errors in the log.

      I wonder what it means to have a non-positive definite var-cov matrix and how to deal with it? 

      Thanks!

ZhaoJin_0-1599449235786.png

 

ZhaoJin_1-1599449269530.png

 

 

%let ret=ret;
%let lv=long_run_var;

proc model data = local_inds noprint;
   parms mu 0 a0 .05 a1 .04 g1 .9 a2 0.1; 
   /* mean model */
   &ret. = mu ;
   /* variance model */
   if zlag(&ret.-mu) > 0 then
      h.&ret. = a0 + a1*xlag((&ret.-mu)**2,mse.&ret.) + g1*xlag(h.&ret.,mse.&ret.);
   else 
      h.&ret. = a0 + a1*xlag((&ret.-mu)**2,mse.&ret.) + g1*xlag(h.&ret.,mse.&ret.) + a2*xlag((&ret.-mu)**2,mse.&ret.);
   /* fit the model */
     /* fit &ret. start=(mu=0 a0=0.05 a1=0.04 g1=0.9 a2=0.1 -0.1) / startiter method = marquardt fiml outest=out outcov MAXITER=1000;*/
      fit &ret.  / method = marquardt fiml outest=out1 outcov MAXITER=1000;
   restrict (a0/(1-a1-g1-0.5*a2))=%SYSEVALF(&lv.);
   restrict  a0>0;
   restrict  g1>0;
   by decade;
   run ;
   quit ;

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

A covariance matrix that has a negative value may still be positive definite. In fact, a covariance matrix MUST be positive semi-definite.

--
Paige Miller
ZhaoJin
Calcite | Level 5

Thanks! But as shown in my screen shot, the negative value is the diagonal one, which is the variance of those parameters estimated. I'm afraid this is not normal?

PaigeMiller
Diamond | Level 26

My apologies for misunderstanding the question.

 

I suspect this is either round-off error, in which case you should assume the variance to be zero, or it is due to the iterative nature of the algorithm which does not enforce that diagonal elements have to be non-negative. There are other statistical methods that sometimes produce a negative variance (which is the correct result for those algorithms). I am not very familiar with PROC MODEL, so that's the best I can explain.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1221 views
  • 0 likes
  • 2 in conversation