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 |
This functions allows to obtain the transition probability matrices for a specific value of x, considering the estimates obtained from mmcx()
.
MMC_tpm(s, x, value = max(x), result)
MMC_tpm(s, x, value = max(x), result)
s |
numerical matrix with categorical data sequences |
x |
exogeneous variable |
value |
fixed value of x |
result |
result from the function |
The function returns a numerical array with the probability transition matrices for each equation
Carolina Vasconcelos and Bruno Damásio
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)
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)
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).
mmcx(y, x, initial, ...)
mmcx(y, x, initial, ...)
y |
matrix of categorical data sequences |
x |
matrix of covariates |
initial |
numerical vector of initial values. |
... |
additional arguments to be passed down to |
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.
Carolina Vasconcelos and Bruno Damásio
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
Optimization is done through auglag()
.
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) x <- stockreturns$spread_1 mmcx(s, x, initial = c(1, 1))
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) x <- stockreturns$spread_1 mmcx(s, x, initial = c(1, 1))
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).
multi.mtd(y, deltaStop = 1e-04, is_constrained = TRUE, delta = 0.1)
multi.mtd(y, deltaStop = 1e-04, is_constrained = TRUE, delta = 0.1)
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. |
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.
See details of the optimization procedure in Berchtold (2001).
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
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) multi.mtd(s)
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) multi.mtd(s)
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.
multi.mtd_probit(y, initial, nummethod = "bfgs")
multi.mtd_probit(y, initial, nummethod = "bfgs")
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 |
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.
Carolina Vasconcelos and Bruno Damásio
Nicolau, J. (2014). A new model for multivariate markov chains. Scandinavian Journal of Statistics, 41(4), 1124-1135.doi:10.1111/sjos.12087
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) multi.mtd_probit(s, initial = c(1, 1, 1), nummethod = "bfgs")
data(stockreturns) s <- cbind(stockreturns$sp500, stockreturns$djia) multi.mtd_probit(s, initial = c(1, 1, 1), nummethod = "bfgs")
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.
stockreturns
stockreturns
A tibble with 2,581 rows and 4 columns:
yyyy-mm-dd of the closing price
S&P500 returns' quantiles
DJIA returns' quantiles
Lagged 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity
S&P500 returns
DJIA returns
https://fred.stlouisfed.org/series/SP500
https://fred.stlouisfed.org/series/DJIA
https://fred.stlouisfed.org/series/T10Y3M