Skip to content
All library documents

Interpreting MSGARCH Transition Parameters and Matrices

Article Quant Q&A · Author: Melly Donald

Summary

The note explains how to interpret transition parameters from a three-state Markov-switching GARCH fit in R’s MSGARCH package. Although a three-state transition matrix has nine entries, only six are independently estimated because each state’s remaining probability is determined by the other probabilities in its row or column, depending on the package’s matrix convention. The package’s summary output displays the fitted matrix, stable state probabilities, and unconditional volatility by state; a dedicated function can return the transition matrix directly.

The example also describes negative transition values as a software issue in the parameter-to-matrix transformation for models with more than two states, with non-converged optimization as another possible source. The reported example and explanation are specific to the package version discussed. The note gives no general convergence diagnostic or model-selection guidance, so users should inspect optimization status and package behavior before interpreting fitted probabilities.

Key ideas

  • A three-state transition matrix contains nine probabilities but only six independent parameters.
  • The remaining transition probabilities follow from the row or column probability constraints.
  • The package summary and transition-matrix function provide readable fitted transition probabilities.
  • Negative entries can indicate a transformation bug or optimizer non-convergence.
  • Fitted state probabilities and volatilities describe additional aspects of the regime model.

Tags

Full text
# MSGARCH package on R


# MSGARCH package on R












I am using the MSGARCH package on R to fit a Markov switching GARCH model. I fit the GARCH model using fit.MLE (so standard Maximum Likelihood), using three regimes. The parameters are estimated and given by the vector:

$\theta = (\alpha_{11}, \alpha_{12}, \alpha_{13}, \alpha_{21}, \alpha_{22}, \alpha_{23}, \beta_{1}, \beta_{2}, \beta_{3}, P_{1}, P_{2}, P_{2}, P_{4}, P_5, P_6)$.

Where the j in $\alpha_{ij}$, $\beta_{j}$ denotes the state. The outputed $P_i$ is only six elements and with negative values. Its not the expected nine elements from the transition Probability matrix. Does anyone know what this is? Or how to lookup the correct matrix $P$?

Here is the code for outputing the vector above (importsnp is a series of log-returns):

```
require(MSGARCH)

library(coda)

snp <- as.matrix(importsnp)*100

spec <- MSGARCH::create.spec(model = c("sGARCH","sGARCH","sGARCH"), 
                             distribution = c("norm","norm","norm"), 
                             do.skew = c(FALSE,FALSE,FALSE), 
                             do.mix = FALSE, 
                             do.shape.ind = FALSE)
set.seed(123) 

fit <- MSGARCH::fit.mle(spec = spec, y = snp)

theta <- fit$theta
```

## Answer by Keven Bluteau (score 3, accepted)

https://quant.stackexchange.com/a/30392

For a more readable output of the fit you can use the function summary():

```
require(MSGARCH)

data("sp500")

snp <- as.matrix(sp500)

spec <- MSGARCH::create.spec(model = c("sGARCH","sGARCH","sGARCH"), 
                             distribution = c("norm","norm","norm"), 
                             do.skew = c(FALSE,FALSE,FALSE), 
                             do.mix = FALSE, 
                             do.shape.ind = FALSE)
set.seed(123) 

fit <- MSGARCH::fit.mle(spec = spec, y = snp, ctr = list(do.init = FALSE, do.enhance.theta0 = TRUE))

summary(fit)
[1] "Specification Type: Markov-Switching"
[1] "Specification Name: sGARCH_normal_sym sGARCH_normal_sym sGARCH_normal_sym"
[1] "Number of parameters in each variance model: 3 3 3"
[1] "Number of parameters in each distribution: 0 0 0"
[1] "Default parameters:"
     alpha0_1 alpha1_1 beta_1 alpha0_2 alpha1_2 beta_2 alpha0_3 alpha1_3 beta_3         P         P         P         P
[1,]      0.1      0.1    0.8      0.1      0.1    0.8      0.1      0.1    0.8 0.3333333 0.3333333 0.3333333 0.3333333
             P         P
[1,] 0.3333333 0.3333333
[1] "DEoptim initialization: FALSE"
[1] "Fitted Parameters:"
         alpha0_1   alpha1_1   beta_1 alpha0_2   alpha1_2    beta_2  alpha0_3  alpha1_3   beta_3       P          P
[1,] 0.0003991736 0.07382696 0.925262    1e-04 0.02250533 0.8543849 0.0848339 0.1587613 0.836886 0.72136 0.03285818
             P          P         P         P
[1,] 0.1856006 0.00248085 0.3555367 0.3865909
[1] "Transition matrix:"
               t = 1      t = 2     t = 3
t + 1 = 1 0.72135997 0.18560065 0.3555367
t + 1 = 2 0.03285818 0.00248085 0.3865909
t + 1 = 3 0.24578185 0.81191850 0.2578724
[1] "Stable probabilities:"
        Stable probabilities
State 1            0.5214967
State 2            0.1460292
State 3            0.3324741
[1] "Unconditional volatility:"
       State 1    State 2 State 3
[1,] 0.6619352 0.02850059 4.41474
Log-kernel:  -6517.631 
AIC:  13209.02 
BIC:  13305.3
```

If you only want to output the transition matrix you can use:

```
MSGARCH::transmat(fit)
               t = 1      t = 2     t = 3
t + 1 = 1 0.72135997 0.18560065 0.3555367
t + 1 = 2 0.03285818 0.00248085 0.3865909
t + 1 = 3 0.24578185 0.81191850 0.2578724
```

There are 6 parameters because the other 3 are redundant since it is 1 minus the sum of the other probabilities associated to the same state.

The negative value was a bug that just has been fixed in the development version where the function transforming the parameter vector into the transition matrix was incorrect when the number of states was above 2. Also, we would sometimes obtain negative value when the optimizer did not converge. We made a change to the optimization scheme to avoid this as much as possible. You can download the source code or the tarball of the development version on Github. It will be on CRAN soon.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.