Question about guess values in MS models

Discussion of models with structural breaks or endogenous switching.
fan
Posts: 215
Joined: Wed Jun 19, 2013 5:14 pm

Question about guess values in MS models

Unread post by fan »

Hi Tom, could you please kindly help me understand the code

Code: Select all

compute temp=mu(3), mu(3)=mu(1),mu(1)=temp
in example KIMNP082.RPF?

Code: Select all

*
* KIMNP082.RPF
* 4.5 Application 2 from pp 82-86 of Kim and Nelson, "State-space Models
* with Regime Switching"
*
* MS AR model with switches in mean and variance.
*
open data int_cpuq.prn
calendar(q) 1947:1
data(format=free,org=columns) 1947:01 1990:04 qtr tbill cpu
*
set infl = log(cpu/cpu{1})*400.0
*
set rrate = tbill-infl
*
boxjenk(ar=4,constant) rrate 1960:1 *
*
@msvarsetup(lags=2,states=3,switch=mh)
# rrate
*
compute gstart=1960:1,gend=1990:4
frml msvarf = log(%MSVARProb(t))
*
nonlin(parmset=msparms) theta
nonlin(parmset=varparms) mu phi sigmav
@msvarinitial gstart gend
*
* Switch around the mu's to match up with the states in the book.
*
compute temp=mu(3),mu(3)=mu(1),mu(1)=temp
*
* Estimate the model by maximum likelihood. This effectively converges,
* but because some of the theta's are very large negative (producing
* transition  probabilities which are nearly zero), the convergence
* tests fail because the transition probabilities are extremely flat in
* that neighborhood.
*
maximize(parmset=varparms+msparms,$
  start=%(p=%mslogisticp(theta),pstar=%MSVARInit()),$
  reject=%MSVARInitTransition()==0,$
  pmethod=simplex,piters=5,method=bfgs,iters=300) msvarf gstart gend
*
* This pegs the two parameters that are pushed to -infinity as large
* fixed negative values.
*
nonlin(parmset=pegs) theta(1,2)=-50.00 theta(2,3)=-50.00
maximize(parmset=varparms+msparms+pegs,$
  start=%(p=%mslogisticp(theta),pstar=%MSVARInit()),$
  reject=%MSVARInitTransition()==0,$
  method=bfgs,iters=300) msvarf gstart gend
In addition, could you please kindly share with us how to get the guess values, such as for means and variances, in MS models?

Thank you and Happy Easter
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Question about guess values in MS models

Unread post by TomDoan »

You chopped out the comments that describe that.

Code: Select all

*
* Switch around the mu's to match up with the states in the book.
*
compute temp=mu(3),mu(3)=mu(1),mu(1)=temp
All MS models have a "labeling" issue---you can freely reorder the regimes without affecting the likelihood. The guess values from @MSVARInitial order the means from low to high, while K&N use high to low. Neither is guaranteed to produce the result in that order, but most of the time it will work to get the labels the way you want.

There are no good ways to get generic guess values for MS models. For models where only one parameter switches (mean or variance typically), the guess values in the standard RATS procedures estimate the base model without switching and create guesses for the states by moving up and down from the base estimate. That works most of the time, but not always. Of course, if there are multiple parameters switching, there is no generic way to create guess values for the regimes---whatever your plans are, the best fitting regimes can be completely different.

These types of issues are covered in detail as part of the Structural Breaks and Switching course.
Post Reply