Recipe function for creating regime switching (Markov transition) functions

Share:

Description

Recipe function for creating regime switching (Markov transition) functions

Usage

1
prep.regimes(values, params, covariates)

Arguments

values

matrix giving the values. Should have (number of Regimes) rows and (number of regimes x number of covariates) columns

params

matrix of the same size as "values" consisting of the names of the parameters

covariates

a vector of the names of the covariates to be used in the regime-switching functions

Details

Note that each row of the transition probability matrix must sum to one. To accomplish this fix at least one transition log odds parameter in each row of "values" (including its intercept and the regression slopes of all covariates) to 0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#Regime-switching with no covariates (self-transition ID)
b <- prep.regimes(values=matrix(0, 3, 3),
params=matrix(c(0, 'p1', 'p2', 'p3', 0, 'p4', 'p5', 'p6', 0), 3, 3))

#Regime switching with no covariates (second regime ID)
b <- prep.regimes(values=matrix(0, 3, 3),
params=matrix(c('p1', 'p2', 'p3', 0, 0, 0, 'p4', 'p5', 'p6'), 3, 3))

#2 regimes with three covariates
b <- prep.regimes(values=matrix(c(0), 2, 8),
params=matrix(c(paste0('p', 8:15), rep(0, 8)), 2, 8),
covariates=c('x1', 'x2', 'x3'))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.