# msVAR

Create Markov-switching dynamic regression model

## Description

The `msVAR`

function returns an
`msVAR`

object that specifies the functional form of a Markov-switching dynamic regression
model for the univariate or multivariate response process
*y*_{t}. The `msVAR`

object also
stores the parameter values of the model.

An `msVAR`

object has two key components:

The components completely specify the model structure. The Markov chain transition matrix and submodel parameters, such as the AR coefficients and innovation-distribution variance, are unknown and estimable unless you specify their values.

To estimate a model containing unknown parameter values, pass the model and data to
`estimate`

. To work
with an estimated or fully specified `msVAR`

object, pass it to an object function.

Alternatively, to create a threshold-switching dynamic regression model, which has a
switching mechanism governed by threshold transitions and observations of a threshold
variable, see `threshold`

and `tsVAR`

.

## Creation

### Description

optionally sets the SeriesNames property, which
associates the names `Mdl`

= msVAR(`mc`

,`mdl`

,`'SeriesNames'`

,seriesNames)`seriesNames`

to the time series of the
model.

### Input Arguments

`mc`

— Discrete-time Markov chain for switching mechanism among states

`dtmc`

object

`mdl`

— State-specific dynamic regression submodels

vector of `arima`

objects | vector of `varm`

objects

State-specific dynamic regression submodels, specified as a length `mc.NumStates`

vector of model objects individually constructed by `arima`

or `varm`

. All submodels must be of the same type (`arima`

or `varm`

) and have the same number of series.

Unlike other model estimation tools, `estimate`

does not infer the size of submodel regression coefficient arrays during estimation. Therefore, you must specify the `Beta`

property of each submodel appropriately. For example, to include and estimate three predictors of the regression component of univariate submodel * j*, set

`mdl(``j`

).Beta = NaN(3,1)

.`msVAR`

processes and stores `mdl`

in the property
Submodels.

## Properties

You can set only the `SeriesNames`

property when you create a model by
using name-value argument syntax or by using dot notation. MATLAB^{®} derives the values of all other properties from inputs `mc`

and `mdl`

.

For example, create a Markov-switching model for a 2-D response series, and then label the
first and second series `"GDP"`

and `"CPI"`

,
respectively.

Mdl = msVAR(mc,mdl); Mdl.SeriesNames = ["GDP" "CPI"];

`NumStates`

— Number of states

positive scalar

This property is read-only.

Number of states, specified as a positive scalar.

**Data Types: **`double`

`NumSeries`

— Number of time series

positive integer

This property is read-only.

Number of time series, specified as a positive integer. `NumSeries`

specifies the dimensionality of the response variable and innovation in all submodels.

**Data Types: **`double`

`StateNames`

— State labels

string vector

This property is read-only.

State labels, specified as a string vector of length
`NumStates`

.

**Data Types: **`string`

`SeriesNames`

— Unique Series labels

`string(1:numSeries)`

(default) | string vector | cell array of character vectors | numeric vector

Unique series labels, specified as a string vector, cell array of character vectors,
or a numeric vector of length `numSeries`

.
`msVAR`

stores the series names as a string vector.

**Data Types: **`string`

`Switch`

— Discrete-time Markov chain for switching mechanism among states

`dtmc`

object

This property is read-only.

Discrete-time Markov chain for the switching mechanism among states, specified as a
`dtmc`

object.

`Submodels`

— State-specific vector autoregression submodels

vector of `varm`

objects

This property is read-only.

State-specific vector autoregression submodels, specified as a vector of `varm`

objects of length `NumStates`

.

`msVAR`

removes unsupported submodel components.

For

`arima`

submodels,`msVAR`

does not support the moving average (MA), differencing, and seasonal components. If any submodel is a composite conditional mean and variance model (for example, its`Variance`

property is a`garch`

object),`msVAR`

issues an error.For

`varm`

submodels,`msVAR`

does not support the trend component.

`msVAR`

converts submodels specified as `arima`

objects to 1-D `varm`

objects.

**Notes**

`NaN`

-valued elements in either the properties of`Switch`

or the submodels of`Submodels`

indicate unknown, estimable parameters. Specified elements, except submodel innovation variances, indicate equality constraints on parameters in model estimation.All unknown submodel parameters are state dependent.

## Object Functions

`estimate` | Fit Markov-switching dynamic regression model to data |

`filter` | Filtered inference of operative latent states in Markov-switching dynamic regression data |

`forecast` | Forecast sample paths from Markov-switching dynamic regression model |

`simulate` | Simulate sample paths of Markov-switching dynamic regression model |

`smooth` | Smoothed inference of operative latent states in Markov-switching dynamic regression data |

`summarize` | Summarize Markov-switching dynamic regression model estimation results |

## Examples

### Create Fully Specified Univariate Model

Create a two-state Markov-switching dynamic regression model for a 1-D response process. Specify all parameter values (this example uses arbitrary values).

Create a two-state discrete-time Markov chain model that describes the regime switching mechanism. Label the regimes.

P = [0.9 0.1; 0.3 0.7]; mc = dtmc(P,'StateNames',["Expansion" "Recession"])

mc = dtmc with properties: P: [2x2 double] StateNames: ["Expansion" "Recession"] NumStates: 2

`mc`

is a `dtmc`

object.

For each regime, use `arima`

to create an AR model that describes the response process within the regime.

% Constants C1 = 5; C2 = -5; % AR coefficients AR1 = [0.3 0.2]; % 2 lags AR2 = 0.1; % 1 lag % Innovations variances v1 = 2; v2 = 1; % AR Submodels mdl1 = arima('Constant',C1,'AR',AR1,... 'Variance',v1,'Description','Expansion State')

mdl1 = arima with properties: Description: "Expansion State" SeriesName: "Y" Distribution: Name = "Gaussian" P: 2 D: 0 Q: 0 Constant: 5 AR: {0.3 0.2} at lags [1 2] SAR: {} MA: {} SMA: {} Seasonality: 0 Beta: [1×0] Variance: 2 ARIMA(2,0,0) Model (Gaussian Distribution)

mdl2 = arima('Constant',C2,'AR',AR2,... 'Variance',v2,'Description','Recession State')

mdl2 = arima with properties: Description: "Recession State" SeriesName: "Y" Distribution: Name = "Gaussian" P: 1 D: 0 Q: 0 Constant: -5 AR: {0.1} at lag [1] SAR: {} MA: {} SMA: {} Seasonality: 0 Beta: [1×0] Variance: 1 ARIMA(1,0,0) Model (Gaussian Distribution)

`mdl1`

and `mdl2`

are fully specified `arima`

objects.

Store the submodels in a vector with order corresponding to the regimes in `mc.StateNames`

.

mdl = [mdl1; mdl2];

Use `msVAR`

to create a Markov-switching dynamic regression model from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 2 NumSeries: 1 StateNames: ["Expansion" "Recession"] SeriesNames: "1" Switch: [1x1 dtmc] Submodels: [2x1 varm]

Mdl.Submodels(1)

ans = varm with properties: Description: "AR-Stationary 1-Dimensional VAR(2) Model" SeriesNames: "Y1" NumSeries: 1 P: 2 Constant: 5 AR: {0.3 0.2} at lags [1 2] Trend: 0 Beta: [1×0 matrix] Covariance: 2

Mdl.Submodels(2)

ans = varm with properties: Description: "AR-Stationary 1-Dimensional VAR(1) Model" SeriesNames: "Y1" NumSeries: 1 P: 1 Constant: -5 AR: {0.1} at lag [1] Trend: 0 Beta: [1×0 matrix] Covariance: 1

`Mdl`

is a fully specified `msVAR`

object representing a univariate two-state Markov-switching dynamic regression model. `msVAR`

stores specified `arima`

submodels as `varm`

objects.

Because `Mdl`

is fully specified, you can pass it to any `msVAR`

object function for further analysis (see Object Functions). Or, you can specify that the parameters of `Mdl`

are initial values for the estimation procedure (see `estimate`

).

### Create Fully Specified Model for US GDP Rate

Consider a two-state Markov-switching dynamic regression model of the postwar US real GDP growth rate. The model has the parameter estimates presented in [1].

Create a discrete-time Markov chain model that describes the regime switching mechanism. Label the regimes.

P = [0.92 0.08; 0.26 0.74]; mc = dtmc(P,'StateNames',["Expansion" "Recession"]);

`mc`

is a fully specified `dtmc`

object.

Create separate AR(0) models (constant only) for the two regimes.

sigma = 3.34; % Homoscedastic models across states mdl1 = arima('Constant',4.62,'Variance',sigma^2); mdl2 = arima('Constant',-0.48,'Variance',sigma^2); mdl = [mdl1 mdl2];

Create the Markov-switching dynamic regression model that describes the behavior of the US GDP growth rate.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 2 NumSeries: 1 StateNames: ["Expansion" "Recession"] SeriesNames: "1" Switch: [1x1 dtmc] Submodels: [2x1 varm]

`Mdl`

is a fully specified `msVAR`

object.

### Create Partially Specified Univariate Model for Estimation

Consider fitting to data a two-state Markov-switching model for a 1-D response process.

Create a discrete-time Markov chain model for the switching mechanism. Specify a 2-by-2 matrix of `NaN`

values for the transition matrix. This setting indicates that you want to estimate all transition probabilities. Label the states.

P = NaN(2); mc = dtmc(P,'StateNames',["Expansion" "Recession"])

mc = dtmc with properties: P: [2x2 double] StateNames: ["Expansion" "Recession"] NumStates: 2

mc.P

`ans = `*2×2*
NaN NaN
NaN NaN

`mc`

is a partially specified `dtmc`

object. The transition matrix `mc.P`

is completely unknown and estimable.

Create AR(1) and AR(2) models by using the shorthand syntax of `arima`

. After you create each model, specify the model description by using dot notation.

```
mdl1 = arima(1,0,0);
mdl1.Description = "Expansion State"
```

mdl1 = arima with properties: Description: "Expansion State" SeriesName: "Y" Distribution: Name = "Gaussian" P: 1 D: 0 Q: 0 Constant: NaN AR: {NaN} at lag [1] SAR: {} MA: {} SMA: {} Seasonality: 0 Beta: [1×0] Variance: NaN ARIMA(1,0,0) Model (Gaussian Distribution)

```
mdl2 = arima(2,0,0);
mdl2.Description = "Recession State"
```

mdl2 = arima with properties: Description: "Recession State" SeriesName: "Y" Distribution: Name = "Gaussian" P: 2 D: 0 Q: 0 Constant: NaN AR: {NaN NaN} at lags [1 2] SAR: {} MA: {} SMA: {} Seasonality: 0 Beta: [1×0] Variance: NaN ARIMA(2,0,0) Model (Gaussian Distribution)

`mdl1`

and `mdl2`

are partially specified `arima`

objects. `NaN`

-valued properties correspond to unknown, estimable parameters.

Store the submodels in a vector with order corresponding to the regimes in `mc.StateNames`

.

mdl = [mdl1; mdl2];

Create a Markov-switching model template from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 2 NumSeries: 1 StateNames: ["Expansion" "Recession"] SeriesNames: "1" Switch: [1x1 dtmc] Submodels: [2x1 varm]

`Mdl`

is a partially specified `msVAR`

object representing a univariate two-state Markov-switching dynamic regression model.

Mdl.Submodels(1)

ans = varm with properties: Description: "1-Dimensional VAR(1) Model" SeriesNames: "Y1" NumSeries: 1 P: 1 Constant: NaN AR: {NaN} at lag [1] Trend: 0 Beta: [1×0 matrix] Covariance: NaN

Mdl.Submodels(2)

ans = varm with properties: Description: "1-Dimensional VAR(2) Model" SeriesNames: "Y1" NumSeries: 1 P: 2 Constant: NaN AR: {NaN NaN} at lags [1 2] Trend: 0 Beta: [1×0 matrix] Covariance: NaN

`msVAR`

converts the `arima`

object submodels to 1-D `varm`

object equivalents.

`Mdl`

is prepared for estimation. You can pass `Mdl`

, along with data and a fully specified model containing initial values for optimization, to `estimate`

.

### Create Fully Specified Multivariate Model

Create a three-state Markov-switching dynamic regression model for a 2-D response process. Specify all parameter values (this example uses arbitrary values).

Create a three-state discrete-time Markov chain model that describes the regime switching mechanism.

P = [10 1 1; 1 10 1; 1 1 10]; mc = dtmc(P); mc.P

`ans = `*3×3*
0.8333 0.0833 0.0833
0.0833 0.8333 0.0833
0.0833 0.0833 0.8333

`mc`

is a `dtmc`

object. `dtmc`

normalizes `P`

so that each row sums to 1.

For each regime, use `varm`

to create a VAR model that describes the response process within the regime. Specify all parameter values.

% Constants (numSeries x 1 vectors) C1 = [1;-1]; C2 = [2;-2]; C3 = [3;-3]; % Autoregression coefficients (numSeries x numSeries matrices) AR1 = {}; % 0 lags AR2 = {[0.5 0.1; 0.5 0.5]}; % 1 lag AR3 = {[0.25 0; 0 0] [0 0; 0.25 0]}; % 2 lags % Innovations covariances (numSeries x numSeries matrices) Sigma1 = [1 -0.1; -0.1 1]; Sigma2 = [2 -0.2; -0.2 2]; Sigma3 = [3 -0.3; -0.3 3]; % VAR Submodels mdl1 = varm('Constant',C1,'AR',AR1,'Covariance',Sigma1); mdl2 = varm('Constant',C2,'AR',AR2,'Covariance',Sigma2); mdl3 = varm('Constant',C3,'AR',AR3,'Covariance',Sigma3);

`mdl1`

, `mdl2`

, and `mdl3`

are fully specified `varm`

objects.

Store the submodels in a vector with order corresponding to the regimes in `mc.StateNames`

.

mdl = [mdl1; mdl2; mdl3];

Use `msVAR`

to create a Markov-switching dynamic regression model from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 3 NumSeries: 2 StateNames: ["1" "2" "3"] SeriesNames: ["1" "2"] Switch: [1x1 dtmc] Submodels: [3x1 varm]

Mdl.Submodels(1)

ans = varm with properties: Description: "2-Dimensional VAR(0) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 0 Constant: [1 -1]' AR: {} Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix]

Mdl.Submodels(2)

ans = varm with properties: Description: "AR-Stationary 2-Dimensional VAR(1) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 1 Constant: [2 -2]' AR: {2×2 matrix} at lag [1] Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix]

Mdl.Submodels(3)

ans = varm with properties: Description: "AR-Stationary 2-Dimensional VAR(2) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 2 Constant: [3 -3]' AR: {2×2 matrices} at lags [1 2] Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix]

`Mdl`

is a fully specified `msVAR`

object representing a multivariate three-state Markov-switching dynamic regression model.

### Create Fully Specified Model Containing Regression Component

Consider including regression components for exogenous variables in each submodel of the Markov-switching dynamic regression model in Create Fully Specified Multivariate Model.

Create a three-state discrete-time Markov chain model that describes the regime switching mechanism.

P = [10 1 1; 1 10 1; 1 1 10]; mc = dtmc(P);

For each regime, use `varm`

to create a VARX model that describes the response process within the regime. Specify all parameter values.

% Constants (numSeries x 1 vectors) C1 = [1;-1]; C2 = [2;-2]; C3 = [3;-3]; % Autoregression coefficients (numSeries x numSeries matrices) AR1 = {}; % 0 lags AR2 = {[0.5 0.1; 0.5 0.5]}; % 1 lag AR3 = {[0.25 0; 0 0] [0 0; 0.25 0]}; % 2 lags % Regression coefficients (numSeries x numRegressors matrices) Beta1 = [1;-1]; % 1 regressor Beta2 = [2 2;-2 -2]; % 2 regressors Beta3 = [3 3 3;-3 -3 -3]; % 3 regressors % Innovations covariances (numSeries x numSeries matrices) Sigma1 = [1 -0.1; -0.1 1]; Sigma2 = [2 -0.2; -0.2 2]; Sigma3 = [3 -0.3; -0.3 3]; % VARX Submodels mdl1 = varm('Constant',C1,'AR',AR1,'Beta',Beta1,... 'Covariance',Sigma1); mdl2 = varm('Constant',C2,'AR',AR2,'Beta',Beta2,... 'Covariance',Sigma2); mdl3 = varm('Constant',C3,'AR',AR3,'Beta',Beta3,... 'Covariance',Sigma3);

`mdl1`

, `mdl2`

, and `mdl3`

are fully specified `varm`

objects representing the state-specified submodels.

Store the submodels in a vector with order corresponding to the regimes in `mc.StateNames`

.

mdl = [mdl1; mdl2; mdl3];

Use `msVAR`

to create a Markov-switching dynamic regression model from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 3 NumSeries: 2 StateNames: ["1" "2" "3"] SeriesNames: ["1" "2"] Switch: [1x1 dtmc] Submodels: [3x1 varm]

Mdl.Submodels(1)

ans = varm with properties: Description: "2-Dimensional VARX(0) Model with 1 Predictor" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 0 Constant: [1 -1]' AR: {} Trend: [2×1 vector of zeros] Beta: [2×1 matrix] Covariance: [2×2 matrix]

Mdl.Submodels(2)

ans = varm with properties: Description: "AR-Stationary 2-Dimensional VARX(1) Model with 2 Predictors" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 1 Constant: [2 -2]' AR: {2×2 matrix} at lag [1] Trend: [2×1 vector of zeros] Beta: [2×2 matrix] Covariance: [2×2 matrix]

Mdl.Submodels(3)

ans = varm with properties: Description: "AR-Stationary 2-Dimensional VARX(2) Model with 3 Predictors" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 2 Constant: [3 -3]' AR: {2×2 matrices} at lags [1 2] Trend: [2×1 vector of zeros] Beta: [2×3 matrix] Covariance: [2×2 matrix]

### Create Partially Specified Multivariate Model for Estimation

Consider fitting to data a three-state Markov-switching model for a 2-D response process.

Create a discrete-time Markov chain model for the switching mechanism. Specify a 3-by-3 matrix of `NaN`

values for the transition matrix. This setting indicates that you want to estimate all transition probabilities.

P = nan(3); mc = dtmc(P);

`mc`

is a partially specified `dtmc`

object. The transition matrix `mc.P`

is completely unknown and estimable.

Create 2-D VAR(0), VAR(1), and VAR(2) models by using the shorthand syntax of `varm`

. Store the models in a vector.

mdl1 = varm(2,0); mdl2 = varm(2,1); mdl3 = varm(2,2); mdl = [mdl1 mdl2 mdl3]; mdl(1)

ans = varm with properties: Description: "2-Dimensional VAR(0) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 0 Constant: [2×1 vector of NaNs] AR: {} Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix of NaNs]

`mdl`

contains three state-specific `varm`

model templates for estimation. `NaN`

values in the properties indicate estimable parameters.

Create a Markov-switching model template from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl)

Mdl = msVAR with properties: NumStates: 3 NumSeries: 2 StateNames: ["1" "2" "3"] SeriesNames: ["1" "2"] Switch: [1x1 dtmc] Submodels: [3x1 varm]

Mdl.Submodels(1)

ans = varm with properties: Description: "2-Dimensional VAR(0) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 0 Constant: [2×1 vector of NaNs] AR: {} Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix of NaNs]

Mdl.Submodels(2)

ans = varm with properties: Description: "2-Dimensional VAR(1) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 1 Constant: [2×1 vector of NaNs] AR: {2×2 matrix of NaNs} at lag [1] Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix of NaNs]

Mdl.Submodels(3)

ans = varm with properties: Description: "2-Dimensional VAR(2) Model" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 2 Constant: [2×1 vector of NaNs] AR: {2×2 matrices of NaNs} at lags [1 2] Trend: [2×1 vector of zeros] Beta: [2×0 matrix] Covariance: [2×2 matrix of NaNs]

`Mdl`

is a partially specified `msVAR`

model for estimation.

### Specify Model Regression Component for Estimation

Consider including regression components for exogenous variables in the submodels of the Markov-switching dynamic regression model in Create Partially Specified Multivariate Model for Estimation. Assume that the VAR(0) model includes the regressor ${\mathit{x}}_{1\mathit{t}}$, the VAR(1) model includes the regressors ${\mathit{x}}_{1\mathit{t}}$ and ${\mathit{x}}_{2\mathit{t}}$, and the VAR(2) model includes the regressors ${\mathit{x}}_{1\mathit{t}}$, ${\mathit{x}}_{2\mathit{t}}$, and ${\mathit{x}}_{3\mathit{t}}$.

Create the discrete-time Markov chain.

P = nan(3); mc = dtmc(P);

Create 2-D VARX(0), VARX(1), and VARX(2) models by using the shorthand syntax of `varm`

. For each model, set the `Beta`

property to a `numSeries`

-by-`numRegressors`

matrix of `NaN`

values by using dot notation. Store all models in a vector.

numSeries = 2; mdl1 = varm(numSeries,0); mdl1.Beta = NaN(numSeries,1); mdl2 = varm(numSeries,1); mdl2.Beta = NaN(numSeries,2); mdl3 = varm(numSeries,2); mdl3.Beta = nan(numSeries,3); mdl = [mdl1; mdl2; mdl3];

Create a Markov-switching dynamic regression model from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,mdl); Mdl.Submodels(2)

ans = varm with properties: Description: "2-Dimensional VARX(1) Model with 2 Predictors" SeriesNames: "Y1" "Y2" NumSeries: 2 P: 1 Constant: [2×1 vector of NaNs] AR: {2×2 matrix of NaNs} at lag [1] Trend: [2×1 vector of zeros] Beta: [2×2 matrix of NaNs] Covariance: [2×2 matrix of NaNs]

### Create Model Specifying Equality Constraints for Estimation

Consider the model in Create Partially Specified Multivariate Model for Estimation. Suppose theory dictates that states do not persist.

Create a discrete-time Markov chain model for the switching mechanism. Specify a 3-by-3 matrix of `NaN`

values for the transition matrix. Indicate that states do not persist by setting the diagonal elements of the matrix to `0`

.

P = nan(3); P(logical(eye(3))) = 0; mc = dtmc(P);

`mc`

is a partially specified `dtmc`

object.

Create the submodels and store them in a vector.

mdl1 = varm(2,0); mdl2 = varm(2,1); mdl3 = varm(2,2); submdl = [mdl1; mdl2; mdl3];

Create a Markov-switching dynamic regression model from the switching mechanism `mc`

and the state-specific submodels `mdl`

.

Mdl = msVAR(mc,submdl); Mdl.Switch.P

`ans = `*3×3*
0 NaN NaN
NaN 0 NaN
NaN NaN 0

`estimate`

treats the known diagonal elements of the transition matrix as equality constraints during estimation. For more details, see `estimate`

.

## More About

### Markov-Switching Dynamic Regression Model

A *Markov-switching dynamic regression model* of a univariate or multivariate response series *y _{t}* describes the dynamic behavior of the series in the presence of structural breaks or regime changes. A collection of state-specific dynamic regression submodels describes the dynamic behavior of

*y*within the regimes.

_{t}$${y}_{t}~\{\begin{array}{cc}{f}_{1}\left({y}_{t};{x}_{t},{\theta}_{1}\right)& ,{s}_{t}=1\\ {f}_{2}\left({y}_{t};{x}_{t},{\theta}_{2}\right)& ,{s}_{t}=2\\ \vdots & \vdots \\ {f}_{n}\left({y}_{t};{x}_{t},{\theta}_{n}\right)& ,{s}_{t}=n\end{array},$$

where:

*s*is a discrete-time Markov chain representing the switching mechanism among regimes (_{t}`Switch`

).*n*is the number of regimes (`NumStates`

).$${f}_{i}\left({y}_{t};{x}_{t},{\theta}_{i}\right)$$ is the regime

*i*dynamic regression model of*y*(_{t}`Submodels`

(*i*)). Submodels are either univariate (ARX) or multivariate (VARX).*x*is a vector of observed exogenous variables at time_{t}*t*.*θ*is the regime_{i}*i*collection of parameters of the dynamic regression model, such as AR coefficients and the innovation variances.

Hamilton [2] proposes a general model, known as Markov-switching autoregression (MSAR), allowing for lagged values of the switching state *s*. Hamilton [3] shows how to convert an MSAR model into a dynamic regression model with a higher-dimensional state space, supported by `msVAR`

.

## References

[1] Chauvet, M., and J. D. Hamilton. "Dating Business Cycle Turning Points." In *Nonlinear Analysis of Business Cycles (Contributions to Economic Analysis, Volume 276)*. (C. Milas, P. Rothman, and D. van Dijk, eds.). Amsterdam: Emerald Group Publishing Limited, 2006.

[2]
Hamilton, J. D. "A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle." *Econometrica*. Vol. 57, 1989, pp. 357–384.

[3]
Hamilton, J. D. "Analysis of Time Series Subject to Changes in Regime." *Journal of Econometrics*. Vol. 45, 1990, pp. 39–70.

[4]
Hamilton, James D. *Time Series Analysis*. Princeton, NJ: Princeton University Press, 1994.

[5]
Krolzig, H.-M. *Markov-Switching Vector Autoregressions*. Berlin: Springer, 1997.

## Version History

**Introduced in R2019b**

## Comando de MATLAB

Ha hecho clic en un enlace que corresponde a este comando de MATLAB:

Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)