Page 1 of 1

MSSysRegression

Posted: Sun May 27, 2012 9:33 am
by samson
Hello,

I am trying to fit a fixed-tansition-probability Markov-switching model with one exogenous variable:

Y_t = b0_st + b1_st * X_t + epsilon_t , and st is either 1 or 0 .

I think that the procedure MSSysRegression.src is what I need, but some errors occur when I apply this procedure.

(In fact, I just modified some code from msvarsetup.src to use @MSSysRegression.)

Code: Select all

@MSSysRegression(states =2,switch=CH)
# Y
# X
frml MSSysRegf = log(%MSSysRegProb(t))
nonlin(parmset=msparms) p
nonlin(parmset=varparms) mu betasys sigmav
@MSSysReginit
maximize(parmset=varparms+msparms, $
start= (pstar=%MSSysRegInit()), $
reject = %MSSysRegInitTransition()==0.0, $
method=bfgs, iters=300) MSSysRegf
In short, my questions are:

1.
When I applied the code above, I got the message like:

## SX11. Identifier %MSSYSREGPROB is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>> log(%MSSysRegProb(<<<<

and

## CP18. MSSYSREGINIT is not the Name of a PROCEDURE. (Did you forget to SOURCE?)
>>>>@MSSysReginit<<<<

How to modifiy the code in order to fit the FTP-MS model with one exogenous variable?

2.
Is that possible to fit the model with @msvarsetup?


I would really appreciate your help~~

Regards,
Samson

Re: MSSysRegression

Posted: Thu May 31, 2012 5:04 pm
by TomDoan
Actually @MSSysRegression is for a systems regression with more than one dependent variable. Instead, you want @MSRegression.

Re: MSSysRegression

Posted: Sun Jul 01, 2012 10:19 am
by samson
Dear Tom:

I try to estimate the MS model with the @msregression procedure.

Here is the code:

Code: Select all

@MSRegression(states=2, switch = ch) r
# constant shock
frml logl = f=%MSRegFVec(t),fpt=%MSProb(t,f),log(fpt)
nonlin(parmset=msparms) p
nonlin(parmset=regparms) betas sigsqv
@MSRegInitial gstart gend
maximize(parmset=regparms+msparms,$
  start=%(pstar=%MSInit()),$
  method=bfgs,iters=300) logl gstart gend
But error occurs when i run this procedure.

Code: Select all

## MAT15. Subscripts Too Large or Non-Positive
The Error Occurred At Location 196, Line 19 of %MSPROB
What does that mean?


Best regards,
Samson

Re: MSSysRegression

Posted: Sun Jul 01, 2012 11:27 am
by TomDoan
Add an

@MSFilterInit

before the MAXIMIZE. It makes sure everything is set up properly.

Re: MSSysRegression

Posted: Sun Jul 01, 2012 8:00 pm
by samson
It works!!

Thank you for your kind and instant reply :D

Best regards,
Samson