Page 1 of 1

Problem with MSVAR estimation

Posted: Sun Mar 03, 2013 10:35 am
by chauhal
Dear Tom Doan,

I have the problem with MSVAR estimation.

source msvarsetup.src
open data forex.xls
cal(weekly) 2005 6 3
data(for=xls,org=columns) 2005:6:3 2011:12:30 SG KR TL ML ID PH
compute gstart=2005:6:3, gend=2011:12:30
@msvarsetup(lags=3,states=2,switch=mh)
# SG KR TL ML ID PH
@msvarinitial gstart gend
@msvaremgeneralsetup
do emits=1,50
@msvaremstep gstart gend
disp "Iteration" emits "LOg Likelihood" %logl
end do emits

The output reports:
Iteration 1 Log Likelihood NA
The Error Occurred At Location 186, Line 19 of %MSVARINIT
Called From Location 200, Line 11 of MSVARFILTERINIT
Called From Location 82, Line 10 of MSVARFILTER
Called From Location 62, Line 9 of MSVARESTEP
Called From Location 118, Line 9 of MSVAREMSTEP
Called From Location 68, Line 2 of loop/block
## MAT14. Non-invertible Matrix. Using Generalized Inverse for SYMMETRIC

(and the same for Iteration 2-50)

Could you please tell me why the problem and how should I do to fix that.
Thank you very much!

Best wishes,

Chau Le

Re: Problem with MSVAR estimation

Posted: Sun Mar 03, 2013 10:46 am
by TomDoan
Your GSTART isn't allowing for data points lost to lags.

Re: Problem with MSVAR estimation

Posted: Mon Mar 04, 2013 12:54 pm
by chauhal
Dear Tom Doan,

I reduce the period to avoid gstart from data points lost to lags. But I also face the same problem (attached data).
One more issue is that how could I get the regime-dependent impulse response functions for MSVAR model?
Thank you very much for your kind help!

Best wishes,

Chau

Re: Problem with MSVAR estimation

Posted: Mon Mar 04, 2013 6:51 pm
by TomDoan
Why would the data file be different? You need the early part of the data for the lags. Keep the original data and adjust GSTART.

Re: Problem with MSVAR estimation

Posted: Tue Mar 05, 2013 3:13 am
by chauhal
I got it. Thanks for your advice, Tom.

Re: Problem with MSVAR estimation

Posted: Fri Mar 08, 2013 8:23 am
by chauhal
Dear Tom,

I try to run MSVAR on CDS data, but I got the report: NO CONVERGENCE IN 400 ITERATIONS.
I increase the mumber of iterations and reestimate the model and then I got the following information:

NO CONVERGENCE IN 536 ITERATIONS
LAST CRITERION WAS 0.0000000
SUBITERATIONS LIMIT EXCEEDED.
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK

Would you please kindly advise me how to sort out the problem. Following is the code and my data.

Thank you so much!

source msvarsetup.src
open data CDS.xls
cal(weekly) 2006 4 21
data(for=xls,org=columns) 2006:4:21 2010:9:24 TL ID PH ML KR HK US
compute gstart=2007:7:5, gend=2010:9:24

SET LTL = LOG(TL)-LOG(TL{1})
SET LID = LOG(ID)-LOG(ID{1})
SET LPH = LOG(PH)-LOG(PH{1})
SET LML = LOG(ML)-LOG(ML{1})
SET LKR = LOG(KR)-LOG(KR{1})
SET LHK = LOG(HK)-LOG(HK{1})
SET LUS = LOG(US)-LOG(US{1})

@msvarsetup(lags=2,states=2,switch=mh)
# LTL LID LPH LML LKR LHK LUS
@msvarinitial gstart gend
nonlin(parmset=varparms) mu phi sigmav
nonlin(parmset=msparms) p
frml msvarf = log(%MSVARProb(t))
maximize(parmset=varparms+msparms,start= (pstar=%MSVARInit()),reject = %msvarinittransition()==0.0,pmethod=simplex, piters=5, method=bfgs,iters=400) msvarf gstart gend

Re: Problem with MSVAR estimation

Posted: Fri Mar 08, 2013 9:13 am
by TomDoan
chauhal wrote:Dear Tom,

I try to run MSVAR on CDS data, but I got the report: NO CONVERGENCE IN 400 ITERATIONS.
I increase the mumber of iterations and reestimate the model and then I got the following information:

NO CONVERGENCE IN 536 ITERATIONS
LAST CRITERION WAS 0.0000000
SUBITERATIONS LIMIT EXCEEDED.
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK

Would you please kindly advise me how to sort out the problem. Following is the code and my data.

Thank you so much!
What happens if you just switch means, not means and variances? The model with switching variances has an unbounded likelihood function, and so can have numerical problems.

Re: Problem with MSVAR estimation

Posted: Sat Mar 09, 2013 7:56 am
by chauhal
Dear Tom,

I did try to switch in mean only but still face the same problem. Would you please suggest me any other solution for this. I am really interested in modelling the switching in both mean and variance. Thanks a lot!

Re: Problem with MSVAR estimation

Posted: Mon Mar 11, 2013 8:00 am
by TomDoan
add

nlpar(derives=second)

at some point before you do the MAXIMIZE. That uses a slower, but more accurate, method of computing the numerical derivatives.

Re: Problem with MSVAR estimation

Posted: Mon Mar 11, 2013 8:09 am
by chauhal
Thanks alot for your advice, Tom.