switchreg |

Estimate a switching regression model (simple exogenous or Markov).

Syntax

switchreg(options) dependent_var list_of_varying_regressors [ @nv list_of_nonvarying_regressors ] [ @prv list_of_probability_regressors ]

List the switchreg keyword, followed by options, then the dependent variable and a list of the regressors with regime-varying coefficients, following optionally by the keyword @nv and a list of regressors with regime-invariant coefficients, and by the keyword @prv and a list of regressors that enter into the transition probability specification.

The dependent variable in switchreg may not be an expression. Dynamics may be specified by including lags of the dependent variable as regressors, or by specifying AR errors using the AR keyword. The latter incorporate mean adjusted lags of the form specified by the “Hamilton-model.”

Options

type=arg | Type of switching: simple exogenous (“simple”), Markov (“markov”). |

nstates=integer (default=2) | Number of regimes. |

heterr | Allow for heterogeneous error variances across regimes |

fprobmat=arg | Name of fixed transition probability matrix allows for fixing specific elements of the time-invariant transition matrix. Leave NAs in elements of the matrix to estimate. The element of the matrix corresponds to . |

initprob=arg (default=“ergodic”) | Method for determining initial Markov regime probabilities: ergodic solution (“ergodic”), estimated parameter (“est”), equal probabilities (“uniform”), user-specified probabilities (“user”). If “initprob=user” is specified, you will need to specify the “userinit=” option. |

userinit=arg | Name of vector containing user-specified initial Markov probabilities. The vector should have rows equal to the number of states; we expand this to the size of the initial lag state vector where necessary for AR specifications. For use in specifications containing both the “type=markov” and “initprob=user” options. |

startnum=arg (default=0 or 25) | Number of random starting values tried. The default is 0 for user-supplied coefficients (option “s”) and 25 in all other cases. |

startiter=arg (default=10) | Number of iterations taken after each random start before comparing objective to determine final starting value. |

searchnum=arg (default=0) | Number of post-estimation perturbed starting values tried. |

searchstds=arg (default=1) | Number of standard deviations to use in perturbed starts (if “searchnum=”) is specified. |

seed=positive_integer from 0 to 2,147,483,647 | Seed the random number generator. If not specified, EViews will seed random number generator with a single integer draw from the default global random number generator. |

Type of random number generator: improved Knuth generator (“kn”), improved Mersenne Twister (“mt”), Knuth’s (1997) lagged Fibonacci generator used in EViews 4 (“kn4”) L’Ecuyer’s (1999) combined multiple recursive generator (“le”), Matsumoto and Nishimura’s (1998) Mersenne Twister used in EViews 4 (“mt4”). |

In addition to the specification options, there are options for estimation and covariance calculation.

Additional Options

optmethod = arg | Optimization method: “bfgs” (BFGS); “newton” (Newton-Raphson), “opg” or “bhhh” (OPG or BHHH), “legacy” (EViews legacy). BFGS is the default method. |

optstep = arg | Step method: “marquardt” (Marquardt); “dogleg” (Dogleg); “linesearch” (Line search). Marquardt is the default method. |

m=integer | Set maximum number of iterations. |

c=scalar | Set convergence criterion. The criterion is based upon the maximum of the percentage changes in the scaled coefficients. The criterion will be set to the nearest value between 1e-24 and 0.2. |

cov=arg | Covariance method: “ordinary” (default method based on inverse of the estimated information matrix), “huber” or “white” (Huber-White sandwich method). |

covinfo = arg | Information matrix method: “opg” (OPG); “hessian” (observed Hessian). (Applicable when non-legacy “optmethod=”.) |

nodf | Do not degree-of-freedom correct the coefficient covariance estimate. |

coef=arg | Specify the name of the coefficient vector (if specified by list); the default behavior is to use the “C” coefficient vector. |

s | Use the current coefficient values in “C” as starting values (see also param ). |

s=number | Specify a number between zero and one to determine starting values as a fraction of EViews default values (out of range values are set to “s=1”). |

showopts / ‑showopts | [Do / do not] display the starting coefficient values and estimation options in the estimation output. |

prompt | Force the dialog to appear from within a program. |

p | Print results. |

Examples

switchreg(type=markov) y c @nv ar(1) ar(2) ar(3) ar(4)

estimates a Hamilton-type Markov switching regression model with four non-regime varying autoregressive terms implying mean adjustment for the lagged endogenous.

switchreg(type=markov) y c @nv y(-1) y(-2) y(-3) y(-4)

specifies an alternate dynamic model in which the lags enter directly into the contemporaneous equation without mean adjustment.

switchreg(type=markov) yy_dalt c @nv ar(1) ar(2) ar(3) ar(4) @prv c yy_ldalt

estimates a 2 state model with non-varying AR(4) and transition matrix probability regressor YY_LDALT.

Cross-references

See “Switching Regression” for a description of the switching regression methodology.

See also Equation::rgmprobs, Equation::transprobs, Equation::makergmprobs and Equation::maketransprobs, for routines that allow you to work with the regime probabilities and transition probabilities.