Package 'GenMarkov'

Title: Multivariate Markov Chains
Description: Provides routines to estimate the Mixture Transition Distribution Model based on Raftery (1985) <http://www.jstor.org/stable/2345788> and Nicolau (2014) <doi:10.1111/sjos.12087> specifications, for multivariate data. Additionally, provides a function for the estimation of a new model for multivariate non-homogeneous Markov chains. This new specification, Generalized Multivariate Markov Chains (GMMC) was proposed by Carolina Vasconcelos and Bruno Damasio and considers (continuous or discrete) covariates exogenous to the Markov chain.
Authors: Carolina Vasconcelos [aut, cre], Bruno Damasio [aut]
Maintainer: Carolina Vasconcelos <[email protected]>
License: GPL (>= 2)
Version: 0.2.0
Built: 2024-12-14 06:41:44 UTC
Source: CRAN

Help Index


Transition Probability Matrices

Description

This functions allows to obtain the transition probability matrices for a specific value of x, considering the estimates obtained from mmcx().

Usage

MMC_tpm(s, x, value = max(x), result)

Arguments

s

numerical matrix with categorical data sequences

x

exogeneous variable

value

fixed value of x

result

result from the function mmcx()

Value

The function returns a numerical array with the probability transition matrices for each equation

Author(s)

Carolina Vasconcelos and Bruno Damásio

Examples

data(stockreturns)
s <- cbind(stockreturns$sp500, stockreturns$djia)
x <- stockreturns$spread_1
res <- mmcx(s, x, initial = c(1, 1))
tpm <- MMC_tpm(s, x, value = max(x), result = res)

Non-homogeneous Multivariate Markov Chains

Description

Estimates Multivariate Markov Chains that depend on a exogeneous variables. The model is based on the Mixture Transition Distribution model, and considers non-homogeneous Markov Chains, instead of homogeneous Markov Chains as in Raftery (1985).

Usage

mmcx(y, x, initial, ...)

Arguments

y

matrix of categorical data sequences

x

matrix of covariates

initial

numerical vector of initial values.

...

additional arguments to be passed down to auglag().

Value

The function returns a list with the parameter estimates, standard-errors, z-statistics, p-values and the value of the log-likelihood function, for each equation.

Author(s)

Carolina Vasconcelos and Bruno Damásio

References

Raftery, A. E. (1985). A Model for High-Order Markov Chains. Journal of the Royal Statistical Society. Series B (Methodological), 47(3), 528-539. http://www.jstor.org/stable/2345788

Ching, W. K., E. S. Fung, and M. K. Ng (2002). A multivariate Markov chain model for categorical data sequences and its applications in demand predictions. IMA Journal of Management Mathematics, 13(3), 187-199. doi:10.1093/imaman/13.3.187

See Also

Optimization is done through auglag().

Examples

data(stockreturns)
s <- cbind(stockreturns$sp500, stockreturns$djia)
x <- stockreturns$spread_1
mmcx(s, x, initial = c(1, 1))

Estimation of Multivariate Markov Chains - MTD model

Description

This function estimates the Mixture Distribution Model (Raftery (1985)) for Multivariate Markov Chains. It considers Berchtold (2001) optimization algorithm for the parameters and estimates the probabilities transition matrices as proposed in Ching (2002).

Usage

multi.mtd(y, deltaStop = 1e-04, is_constrained = TRUE, delta = 0.1)

Arguments

y

matrix of categorical data sequences

deltaStop

value below which the optimization phases of the parameters stop

is_constrained

flag indicating whether the function will consider the usual set of constraints (usual set: TRUE, new set of constraints: FALSE).

delta

the amount of change to increase/decrease in the parameters for each iteration of the optimization algorithm.

Value

The function returns a list with the parameter estimates, standard-errors, z-statistics, p-values and the value of the log-likelihood function, for each equation.

Note

See details of the optimization procedure in Berchtold (2001).

References

Raftery, A. E. (1985). A Model for High-Order Markov Chains. Journal of the Royal Statistical Society. Series B (Methodological), 47(3), 528-539. http://www.jstor.org/stable/2345788

Berchtold, A. (2001). Estimation in the Mixture Transition Distribution Model. Journal of Time Series Analysis, 22(4), 379-397.doi:10.1111/1467-9892.00231

Ching, W. K., E. S. Fung, and M. K. Ng (2002). A multivariate Markov chain model for categorical data sequences and its applications in demand predictions. IMA Journal of Management Mathematics, 13(3), 187-199. doi:10.1093/imaman/13.3.187

Examples

data(stockreturns)
s <- cbind(stockreturns$sp500, stockreturns$djia)
multi.mtd(s)

Estimation of Multivariate Markov Chains: MTD - Probit Model

Description

Estimation of Multivariate Markov Chains through the proposed model by Nicolau (2014). This model presents two attractive features: it is completely free of constraints, thereby facilitating the estimation procedure, and it is more precise at estimating the transition probabilities of a multivariate or higher-order Markov chain than the Raftery's MTD model.

Usage

multi.mtd_probit(y, initial, nummethod = "bfgs")

Arguments

y

matrix of categorical data sequences

initial

numerical vector of initial values

nummethod

Numerical maximisation method, currently either "NR" (for Newton-Raphson), "BFGS" (for Broyden-Fletcher-Goldfarb-Shanno), "BFGSR" (for the BFGS algorithm implemented in R), "BHHH" (for Berndt-Hall-Hall-Hausman), "SANN" (for Simulated ANNealing), "CG" (for Conjugate Gradients), or "NM" (for Nelder-Mead). Lower-case letters (such as "nr" for Newton-Raphson) are allowed. The default method is "BFGS". For more details see maxLik().

Value

The function returns a list with the parameter estimates, standard-errors, z-statistics, p-values and the value of the log-likelihood function, for each equation.

Author(s)

Carolina Vasconcelos and Bruno Damásio

References

Nicolau, J. (2014). A new model for multivariate markov chains. Scandinavian Journal of Statistics, 41(4), 1124-1135.doi:10.1111/sjos.12087

Examples

data(stockreturns)
s <- cbind(stockreturns$sp500, stockreturns$djia)
multi.mtd_probit(s, initial = c(1, 1, 1), nummethod = "bfgs")

Stock returns data

Description

Data from 5-week-day daily stock returns (rt = 100 x log(Pt/Pt-1), where Pt is the adjusted close price) of two indexes, S&P500 and DJIA, from November 11th 2011 to September 1st 2021. The dataset also includes the interest rate spread, the 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity. The data was retrieved from FRED.

Usage

stockreturns

Format

A tibble with 2,581 rows and 4 columns:

date

yyyy-mm-dd of the closing price

sp500

S&P500 returns' quantiles

djia

DJIA returns' quantiles

spread_1

Lagged 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity

returns_sp500

S&P500 returns

djia

DJIA returns

Source

https://fred.stlouisfed.org/series/SP500

https://fred.stlouisfed.org/series/DJIA

https://fred.stlouisfed.org/series/T10Y3M