Title: | Bayesian Approach for MTAR Models with Missing Data |
---|---|
Description: | Implements parameter estimation using a Bayesian approach for Multivariate Threshold Autoregressive (MTAR) models with missing data using Markov Chain Monte Carlo methods. Performs the simulation of MTAR processes (mtarsim()), estimation of matrix parameters and the threshold values (mtarns()), identification of the autoregressive orders using Bayesian variable selection (mtarstr()), identification of the number of regimes using Metropolised Carlin and Chib (mtarnumreg()) and estimate missing data, coefficients and covariance matrices conditional on the autoregressive orders, the threshold values and the number of regimes (mtarmissing()). Calderon and Nieto (2017) <doi:10.1080/03610926.2014.990758>. |
Authors: | Valeria Bejarano Salcedo <[email protected]>, Sergio Alejandro Calderon Villanueva <[email protected]> Andrey Duvan Rincon Torres <[email protected]> |
Maintainer: | Andrey Duvan Rincon Torres <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2025-01-24 05:27:27 UTC |
Source: | https://github.com/adrincont/bmtar |
Compute by Bayesian methodology a MTAR model for some data
auto_mtar(Yt, Zt = NULL, Xt = NULL, l0_min = 2, l0_max = 3, maxorders = list(pj = 2,qj = 0,dj = 0), niter = 3000, chain = FALSE, method = 'KUO',parallel = FALSE)
auto_mtar(Yt, Zt = NULL, Xt = NULL, l0_min = 2, l0_max = 3, maxorders = list(pj = 2,qj = 0,dj = 0), niter = 3000, chain = FALSE, method = 'KUO',parallel = FALSE)
Yt |
matrix type object, observed process. Not NULL |
Zt |
matrix type object, threshold process. Default NULL |
Xt |
matrix type object, covariate process. Default NULL |
l0_min |
numeric type between 1 and 4, number of regimes minimum to consider. Default 2 |
l0_max |
numeric type between 1 and 4, number of regimes maximum to consider. Default 3 |
maxorders |
list type object with names (pj,qj,dj), maximum lags consider for the processes in each regime. Default pj = 2, qj = 0,dj = 0 |
niter |
numeric type, number of runs for every estimation. Default 3000 |
chain |
logical type, if return chains of estimations parameters and values (if missing) |
method |
character type, must be one “KUO” or “SSVS” |
parallel |
logical, if |
The default arguments are designed for rapid estimation of models for any data (Yt, Zt and Xt). Returns the fit of MTAR model.
The function conducts Bayesian estimation with “niter” chains of the number of regimes with maximum “l0” and within the maximum lags orders provided “maxorders”.
It can be a little be faster when used “parallel” for parallel
package.
Return list type object
tsregime |
class “ |
numreg |
class “ |
pars |
class “ |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data('datasim') data = datasim$Sim auto = auto_mtar(Yt = data$Yt, Zt = data$Zt,niter = 1000)
data('datasim') data = datasim$Sim auto = auto_mtar(Yt = data$Yt, Zt = data$Zt,niter = 1000)
autoplot
uses ggplot2 to draw a particular plot for an object of a
particular class in a single command. This defines the S3 generic that
other classes and packages can extend.
autoplot(object, ...)
autoplot(object, ...)
object |
an object, whose class will determine the behaviour of autoplot |
... |
other arguments passed to specific methods |
a ggplot object
autolayer()
, ggplot()
and fortify()
Produces a ggplot object for the results of the mtarforecast function.
## S3 method for class 'regime_forecast' autoplot(object, type = 1,...)
## S3 method for class 'regime_forecast' autoplot(object, type = 1,...)
object |
Object of class “ |
type |
numeric giving the type of plot to be computed. Allowed
values are 1 for list of “ |
... |
other arguments passed to specific methods |
Graph the strings for the outputs corresponding to the functions “mtarforecast
” which return an object of class “regim_forecast
”. The chains corresponding to the samplings in each case do not contain the burning period.
Return a ggplot object.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
library(ggplot2) data('datasim') estim = mtarns(mtarinipars(tsregime(datasim$Sim$Yt,datasim$Sim$Zt), list_model = list(pars = list(l = datasim$Sim$l,r = datasim$Sim$r, orders = list(pj = datasim$pj))))) forecast = mtarforecast(estim,h = 10) autoplot.regime_forecast(forecast,1)
library(ggplot2) data('datasim') estim = mtarns(mtarinipars(tsregime(datasim$Sim$Yt,datasim$Sim$Zt), list_model = list(pars = list(l = datasim$Sim$l,r = datasim$Sim$r, orders = list(pj = datasim$pj))))) forecast = mtarforecast(estim,h = 10) autoplot.regime_forecast(forecast,1)
Produces a ggplot object for the results of the mtarmissing function.
## S3 method for class 'regime_missing' autoplot(object, type = 1,...)
## S3 method for class 'regime_missing' autoplot(object, type = 1,...)
object |
Object of class “ |
type |
character string giving the type of plot to be computed. Allowed
values are 1 for " |
... |
other arguments passed to specific methods |
Graph the strings for the outputs corresponding to the functions “mtarmissing
” which return an object of class “regim_missing
”. The chains corresponding to the samplings in each case do not contain the burning period.
Return a ggplot object.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
library(ggplot2) data('missingest') autoplot.regime_missing(missingest,1)
library(ggplot2) data('missingest') autoplot.regime_missing(missingest,1)
Produces a ggplot object for the results of the mtarns and mtarstr functions.
## S3 method for class 'regime_model' autoplot(object, type = 1,...)
## S3 method for class 'regime_model' autoplot(object, type = 1,...)
object |
Object of class “ |
type |
character string giving the type of plot to be computed. Allowed
values are 1 for " |
... |
other arguments passed to specific methods |
Graph the strings for the outputs corresponding to the functions “mtarns
” and “mtarstr
” which return an object of class “regime_model
”. The chains corresponding to the samplings in each case do not contain the burning period.
Return a ggplot object.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
library(ggplot2) data("datasim") data = datasim$Sim$Zt parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE) autoplot.regime_model(estim1,2) autoplot.regime_model(estim1,3) autoplot.regime_model(estim1,5)
library(ggplot2) data("datasim") data = datasim$Sim$Zt parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE) autoplot.regime_model(estim1,2) autoplot.regime_model(estim1,3) autoplot.regime_model(estim1,5)
Produces a ggplot object for the results of the mtarnumreg function.
## S3 method for class 'regime_number' autoplot(object, type = 1,...)
## S3 method for class 'regime_number' autoplot(object, type = 1,...)
object |
Object of class “ |
type |
numeric giving the type of plot to be computed. Allowed
values are 1 for list of “ |
... |
other arguments passed to specific methods |
Graph the strings for the outputs corresponding to the functions “mtarnumreg
” which return an object of class “regim_numreg
”. The chains corresponding to the samplings in each case do not contain the burning period.
Return a ggplot object.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
library(ggplot2) data('datasim_numreg') autoplot.regime_numreg(datasim_numreg,1)
library(ggplot2) data('datasim_numreg') autoplot.regime_numreg(datasim_numreg,1)
Produces a ggplot object for the results of the tsregime function.
## S3 method for class 'tsregime' autoplot(object, type = 1,...)
## S3 method for class 'tsregime' autoplot(object, type = 1,...)
object |
Object of class “ |
type |
character string giving the type of plot to be computed. Allowed
values are 1 for " |
... |
other arguments passed to specific methods |
Graph for the stochastic processes of the object \ dQuote \ code tsregime for: Output process and if they exist for: Threshold process and Covariates process. In the case that there are missing data, a red line is drawn at the indicated time.
Return a ggplot object.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") yt = datasim$Sim Yt = yt$Yt Zt = yt$Zt data = tsregime(Yt,Zt) autoplot.tsregime(data)
data("datasim") yt = datasim$Sim Yt = yt$Yt Zt = yt$Zt data = tsregime(Yt,Zt) autoplot.tsregime(data)
simulated MTAR process
data(datasim)
data(datasim)
Object with class mtarsim
R Simulate
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
simulated MTAR process with missing data
data(datasim)
data(datasim)
Object with class mtarsim
R Simulate
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
object of class “regime_number
”
data(datasim_numreg)
data(datasim_numreg)
Object with class regime_number
R Simulate
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
Tests to help evaluate some assumptions about the MTAR model. calculating some tests and graphs.
diagnostic_mtar(regime_model,lagmax = NULL,alpha = '0.05')
diagnostic_mtar(regime_model,lagmax = NULL,alpha = '0.05')
regime_model |
Object of class “ |
lagmax |
maximum lag at which to calculate the acf and pacf. Default NULL |
alpha |
level of significance for the graphs, should take values in c('0.10','0.05','0.025','0.01','0.005'). Default '0.05' |
For the graphical tests it returns: “Residuals serie plot
”, “Standardized residuals serie plot
”,“Residuals density plot
” (overlaps a standard normal density),“CUSUM
” statistic for residuals,,“Cusum square
” statistic for residuals, “ACF
” and “PACF
” plots for residuals series.
Returns a list of ggplot objects with the graphics mentioned before.
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
library(ggplot2) data("datasim") data = datasim$Sim$Z parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE,burn = 500) diagnostic_mtar(estim1)
library(ggplot2) data("datasim") data = datasim$Sim$Z parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE,burn = 500) diagnostic_mtar(estim1)
Compute multivariate normal density with class Brobdingnag
objects.
dmnormB(x,mean,sigma)
dmnormB(x,mean,sigma)
x |
numeric type object, value to compute the density of multivariate normal distribution. Not NULL |
mean |
numeric type, mean of multivariate normal distribution. Not NULL |
sigma |
matrix type object, covariance parameter of multivariate normal distribution. Not NULL |
object class Brobdingnag
Compute Wishart density with class Brobdingnag
objects.
dwishartB(x,nu,S)
dwishartB(x,nu,S)
x |
matrix type object, value to compute the density of Wishart distribution. Not NULL |
nu |
numeric type, degrees of freedom. Not NULL |
S |
matrix type object, parameter of Wishart distribution. Not NULL |
object class Brobdingnag
Diary rainfall (in mm) and the diary river flow (in m^3/s) of two rivers where a river empties into the other one in a region of department of Cauca in Colombia.
data(hydrodata)
data(hydrodata)
data.frame
IDEAM, the oficial Colombian agency for hydrological and meteorological studies
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
From a threshold variable and the corresponding processes calculate a vector indicating the number of the regime of each observation.
lists_ind(r,Zt,l,...)
lists_ind(r,Zt,l,...)
r |
value for the threshold variable |
Zt |
threshold processes univariate |
l |
number of regimes |
... |
other arguments passed to specific methods |
Vector of length N indicating the number of the regime of each observation
Results example missing data estimation process for a mtar process
data(missingest)
data(missingest)
Object whit class mtar_missing
R Simulation
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi: 10.1080/03610926.2014.990758.
regime
” creationCreate an object of class “regime
” given nonstructural and structural parameters for each regime.
mtaregime(orders = list(p = 1,q = 0,d = 0), cs = NULL, Phi, Beta = NULL, Delta = NULL, Sigma)
mtaregime(orders = list(p = 1,q = 0,d = 0), cs = NULL, Phi, Beta = NULL, Delta = NULL, Sigma)
orders |
list type object with names (p,q,d), number of lags of Yt, Xt and Zt, respectively. Default p = 1, q = 0, d = 0 |
cs |
matrix type object, the constant term of the regime specification. Default NULL |
Phi |
list type object with names (phi1, ..., phip), each one a matrix |
Beta |
list type object with names (beta1, ..., betaq), each one a matrix |
Delta |
list type object with names (delta1, ..., deltad), each one a matrix |
Sigma |
a positive-definite symmetric matrix |
Causes creation of the object class “regime
”. Sigma matrix corresponds to (root of the covariance matrix). When cs is not specified or only matrices are delivered for some lags, the function assumes unspecified 0 (matrix). Rows number in the Phi, Beta and Delta matrix should be the same (k dimension of variables in Yt).
Return list type object of class “regime
” with the values of the arguments
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
# Creation of parameters for regimen with orders = c(2,1,1), nu = 1 y k = 2. ## previous objects orders = list(p = 2,q = 1,d = 1) Phi = list(phi2 = matrix(c(0.1,0.6,-0.4,0.5),2,2, byrow = TRUE)) Beta = list(beta1 = matrix(c(0.3,-0.4),2, 1)) Delta = list(delta1 = matrix(c(0.6,1),2,1)) Sigma = matrix(c(1,0.6,0.6,1.5),2,2,byrow = TRUE) cs = matrix(c(1,-1),nrow = 2) ## creacion de la clase regime Ri = mtaregime(orders = orders,Phi = Phi,Beta = Beta,Delta = Delta, Sigma = Sigma,cs = cs) class(Ri)
# Creation of parameters for regimen with orders = c(2,1,1), nu = 1 y k = 2. ## previous objects orders = list(p = 2,q = 1,d = 1) Phi = list(phi2 = matrix(c(0.1,0.6,-0.4,0.5),2,2, byrow = TRUE)) Beta = list(beta1 = matrix(c(0.3,-0.4),2, 1)) Delta = list(delta1 = matrix(c(0.6,1),2,1)) Sigma = matrix(c(1,0.6,0.6,1.5),2,2,byrow = TRUE) cs = matrix(c(1,-1),nrow = 2) ## creacion de la clase regime Ri = mtaregime(orders = orders,Phi = Phi,Beta = Beta,Delta = Delta, Sigma = Sigma,cs = cs) class(Ri)
Bayesian method to compute forecasts of a MTAR model
mtarforecast(regimemodel,h,level = 0.95, chain = FALSE, b = NULL)
mtarforecast(regimemodel,h,level = 0.95, chain = FALSE, b = NULL)
regimemodel |
object of class “ |
h |
numeric type, steps for forecast. Not NULL |
level |
numeric type, confident interval for estimations. Default 0.95 |
chain |
logical type, if return chains of forecasts. Default TRUE |
b |
numeric type greater or equal 1, autoregressive order of Ut = (Zt ,Xt). Default NULL meaning 1 |
Based on the equation of the Multivariate Threshold Autoregressive(MTAR) Model
where process is a k-variate independent Gaussian process,
is k-variate process,
The function implements Bayesian estimation that gives us the forecasts
for the response and exogenous variable vectors. The coverage percentages
of the forecast intervals and the variability of the predictive distributions.
Return a list type object
forecast |
list type object with confident interval, mean value of the forecasts and if the chains if TRUE |
tsregime |
object of class tsregime of the final Output process with forecast |
FNDP |
Frobenius norm of the covariance matrix of the predictive distribution for Yt and Ut |
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S., & Nieto, F. H. (2021). Forecasting with Multivariate Threshold Autoregressive Models. Revista Colombiana de Estadística, 44(2), 369-383.
data = datasim parameters = list(l = 2, orders = list(pj = c(1,1)), r = data$Sim$r) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estimyt = mtarns(ini_obj = initial,niter = 1000,chain = TRUE) pred1 = mtarforecast(regimemodel = estimyt,h = 100)
data = datasim parameters = list(l = 2, orders = list(pj = c(1,1)), r = data$Sim$r) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estimyt = mtarns(ini_obj = initial,niter = 1000,chain = TRUE) pred1 = mtarforecast(regimemodel = estimyt,h = 100)
Model specification of data, known or unknown parameters and its prior distributions
mtarinipars(tsregime_obj, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1), qj = c(0,0), dj = c(0,0)), r = NULL, Sigma = NULL), orders = NULL,l0_min = NULL,l0_max = NULL), method = NULL, theta_prior = NULL, sigma_prior = NULL,gamma_prior = NULL, r_prior = NULL)
mtarinipars(tsregime_obj, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1), qj = c(0,0), dj = c(0,0)), r = NULL, Sigma = NULL), orders = NULL,l0_min = NULL,l0_max = NULL), method = NULL, theta_prior = NULL, sigma_prior = NULL,gamma_prior = NULL, r_prior = NULL)
tsregime_obj |
class “ |
list_model |
list type object with at least one of the names (pars, orders, l0). {pars: list type object with one of the names (l, orders, r, Sigma) for parameters of the model known (l: number of regimes of the model (not known use l0). Default 2 orders:list type object with names (pj,qj,dj) each a vector of length l, specificate lags orders in each regime. Default list(pj = c(1,1), qj = c(0,0), dj = c(0,0)) r: threshold value. Default NULL Sigma: list type object with names (R1, ..., Rl) each a matrix type object, specification of error covariate matrix. Default NULL) orders: list type object with names (pj,qj,dj) each a vector of length l,specificate maximum lags orders in each regime if not known. Default NULL l0_min: numeric type, number minimum of regimes to consider for the model if not known. Default NULL l0_max: numeric type, number maximum of regimes to consider for the model if not known. Default NULL} |
method |
character type object, if orders not known or enter l0 it must be one “KUO” or “SSVS”, when known it is not necessary. Default NULL |
theta_prior |
list type object with names (R1, ..., Rl), each one a list type object with at least one of the names (theta0j,cov0j)(if method “SSVS” (theta0j,cov0j,Cij,Tauij,R)),specification of mean and covariate matrix of the prior distribution for |
sigma_prior |
list type object with names (R1, ..., Rl), each one a list type object with at least one of the names (S0j,nu0j) specification of matrix and degrees of freedom of the prior distribution for |
gamma_prior |
list type object with names (R1, ..., Rl), each one a vector of prior probabilities for |
r_prior |
list type object with at least one name (za, zb, val_rmh), each one a numeric type object with the minimum, maximum value for r and its parameter for Metropolis-Hasting respectively. Default NULL |
list_model its a easy way to identify what need to be estimated in the MTAR model. First, pars refers to known parameters in the model like “l” number of regimes, “orders” lags for output, covariate and threshold processes, “r” threshold value and “Sigma” covariance error matrix for each regime. Also when lags orders or l0 are unknown this could be added to this list. Second, in order to identify autoregressive orders in MTAR models, two methods for stochastic search are selected because it permits us that the estimation is done in only one step. The first method, called Kuo and Mallick (KUO), was introduced in (Kuo & Mallick, 1998) for variable selection in regression models. The second one was proposed in (George & McCulloch, 1993) and it is called Stochastic Search Variable Selection (SSVS). Then “method” refers to one of this two for estimating structural parameters of the MTAR model. Third, all related to prior distributions of our parameters of interest
Return a list type object of class “regime_inipars
”
tsregime_obj |
= tsregime_obj |
pars |
= list_model$pars |
orders |
= list_model$orders or list_model$pars$orders |
method |
= method |
init$r |
= r_prior |
init$Theta |
= theta_prior |
init$Sigma |
= sigma_prior |
init$Gamma |
= gamma_prior |
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") tsregime_obj = datasim$Sim # for estimate non-structural parameters: # mtarns: l always known, # Sigma = NULL = list(R1,R2) can be known, r = NULL can be known # Sigma and r known parameters = list(l = length(datasim$Reg), Sigma = list(R1 = datasim$Reg$R1$sigma,R2 = datasim$Reg$R2$sigma), r = tsregime_obj$r, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars_Sr = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) #only r known parameters = list(l = length(datasim$Reg),Sigma = NULL, r = tsregime_obj$r, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars_r = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) #r and Sigma unknown parameters = list(l = length(datasim$Reg),Sigma = NULL, r = NULL, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) # for estimate structural and non-structural parameters # mtarstr: l always known parameters = list(l = length(datasim$Reg)) orders = list(pj = c(2,2),dj = c(1,1)) initpars_KUO = mtarinipars(tsregime_obj, list_model = list(pars = parameters,orders = orders),method = 'KUO') initpars_SSVS = mtarinipars(tsregime_obj, list_model = list(pars = parameters,orders = orders),method = 'SSVS') # mtarnumreg l0_min or l0_max and method always initpars_l = mtarinipars(tsregime_obj,list_model = list(l0_max = 3),method = 'KUO')
data("datasim") tsregime_obj = datasim$Sim # for estimate non-structural parameters: # mtarns: l always known, # Sigma = NULL = list(R1,R2) can be known, r = NULL can be known # Sigma and r known parameters = list(l = length(datasim$Reg), Sigma = list(R1 = datasim$Reg$R1$sigma,R2 = datasim$Reg$R2$sigma), r = tsregime_obj$r, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars_Sr = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) #only r known parameters = list(l = length(datasim$Reg),Sigma = NULL, r = tsregime_obj$r, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars_r = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) #r and Sigma unknown parameters = list(l = length(datasim$Reg),Sigma = NULL, r = NULL, orders = list(pj = datasim$pj, qj = datasim$qj, dj = datasim$dj)) initpars = mtarinipars(tsregime_obj,list_model = list(pars = parameters)) # for estimate structural and non-structural parameters # mtarstr: l always known parameters = list(l = length(datasim$Reg)) orders = list(pj = c(2,2),dj = c(1,1)) initpars_KUO = mtarinipars(tsregime_obj, list_model = list(pars = parameters,orders = orders),method = 'KUO') initpars_SSVS = mtarinipars(tsregime_obj, list_model = list(pars = parameters,orders = orders),method = 'SSVS') # mtarnumreg l0_min or l0_max and method always initpars_l = mtarinipars(tsregime_obj,list_model = list(l0_max = 3),method = 'KUO')
Estimation using Bayesian methodology of missing values in observed(output), covariate and threshold processes.
mtarmissing(ini_obj,niter = 1000, chain = FALSE, level = 0.95, burn = NULL, cU = 0.5, b = NULL)
mtarmissing(ini_obj,niter = 1000, chain = FALSE, level = 0.95, burn = NULL, cU = 0.5, b = NULL)
ini_obj |
class “ |
niter |
numeric type, number of runs of MCMC. Default 1000 |
chain |
logical type, if return chains of parameters. Default FALSE |
level |
numeric type, confident interval for estimations. Default 0.95 |
burn |
numeric type, number of initial runs. Default NULL (10% of niter) |
cU |
numeric type, coefficient of the diagonal covariance matrix of process Ut = (Zt,Xt). Default 0.5 |
b |
numeric type greater or equal 1, autoregressive order of Ut = (Zt,Xt). Default NULL meaning 1 |
The MTAR model
is written into a state space model with regime-switching where the matrices depend on the threshold variable. In order to estimate the missing data in the observed vector , it is necessary to obtain samples of the full conditional distribution of the state vector
, for all times
using Kalman Filter. It is assumed that the process
is a Markov chain, and in order to get samples of the full conditional distribution of
, it is supposed that kernel and initial distribution
are Gaussian for simplicity. However, in the next updates, we are going to get flexibility at this point.
Return list type object of class “regime_missing
”
tsregime |
ini_obj$tsregime_obj with estimated observations |
estimates |
credibility interval and mean of estimated missing values |
Chain |
if chain TRUE, chains of the estimated missing values |
pos_na |
list for where are the missing values in each process (Yt and Ut) |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") yt = datasim$Sim # some missing data data_yt = yt$Yt data_zt = yt$Zt posNA = sample(c(1:500),8) data_yt[c(posNA),] = c(NA,NA) posNA = sample(c(1:500),8) data_zt[c(posNA)] = NA data_final = tsregime(data_yt,data_zt,r = yt$r) autoplot.tsregime(data_final,1) autoplot.tsregime(data_final,2) initial = mtarinipars(tsregime_obj = data_final, list_model = list(pars = list(l = 2,r = datasim$Sim$r, orders = list(pj = c(1,1), qj = c(0,0),dj = c(0,0))))) missingest = mtarmissing(ini_obj = initial,chain = TRUE, niter = 500,burn = 500) print(missingest) autoplot.regime_missing(missingest,1) datasim$Sim$Yt[is.na(data_yt[,1]),] missingest$tsregime$Yt[is.na(data_yt[,1]),]
data("datasim") yt = datasim$Sim # some missing data data_yt = yt$Yt data_zt = yt$Zt posNA = sample(c(1:500),8) data_yt[c(posNA),] = c(NA,NA) posNA = sample(c(1:500),8) data_zt[c(posNA)] = NA data_final = tsregime(data_yt,data_zt,r = yt$r) autoplot.tsregime(data_final,1) autoplot.tsregime(data_final,2) initial = mtarinipars(tsregime_obj = data_final, list_model = list(pars = list(l = 2,r = datasim$Sim$r, orders = list(pj = c(1,1), qj = c(0,0),dj = c(0,0))))) missingest = mtarmissing(ini_obj = initial,chain = TRUE, niter = 500,burn = 500) print(missingest) autoplot.regime_missing(missingest,1) datasim$Sim$Yt[is.na(data_yt[,1]),] missingest$tsregime$Yt[is.na(data_yt[,1]),]
Compute the Normalized Akaike information criteria (NAIC) of a “regime_model
” class object.
mtarNAIC(regimemodel)
mtarNAIC(regimemodel)
regimemodel |
object of class “ |
Estimation of thresholds was made before starting the Bayesian procedure via the Normalized Akaike information criteria (NAIC) (Tong, 1990), in MTAR model. The NAIC for a MTAR model with l regimes is:
Nj: number of observations in each regime.
Return a list type object:
AICj |
numeric type, AIC for each regime |
NAIC |
numeric type, NAIC value |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim # Estimate number of regimes with NAIC initial1 = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1),dj = c(1,1)), r = 0.2))) estruc1 = mtarns(ini_obj = initial1,niter = 100,chain = TRUE,burn = 100) initial2 = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1),dj = c(1,1)), r = 0.3))) estruc2 = mtarns(ini_obj = initial2,niter = 100,chain = TRUE,burn = 100) #NAIC mtarNAIC(estruc1) mtarNAIC(estruc2)
data("datasim") data = datasim # Estimate number of regimes with NAIC initial1 = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1),dj = c(1,1)), r = 0.2))) estruc1 = mtarns(ini_obj = initial1,niter = 100,chain = TRUE,burn = 100) initial2 = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = list(l = 2, orders = list(pj = c(1,1),dj = c(1,1)), r = 0.3))) estruc2 = mtarns(ini_obj = initial2,niter = 100,chain = TRUE,burn = 100) #NAIC mtarNAIC(estruc1) mtarNAIC(estruc2)
Bayesian method for estimating non-structural parameters of a MTAR model with prior conjugate.
mtarns(ini_obj, level = 0.95, burn = NULL, niter = 1000, chain = FALSE, r_init = NULL)
mtarns(ini_obj, level = 0.95, burn = NULL, niter = 1000, chain = FALSE, r_init = NULL)
ini_obj |
class “ |
level |
numeric type, confident interval for estimations. Default 0.95 |
burn |
numeric type, number of initial runs. Default NULL (30% of niter) |
niter |
numeric type, number of runs of MCMC. Default 1000 |
chain |
logical type, if return chains of parameters. Default FALSE |
r_init |
numeric type of length l - 1. If r not known, starting value of the chain. Default NULL |
Based on the equation of the Multivariate Threshold Autoregressive(MTAR) Model
where process is a k-variate independent Gaussian process,
is k-variate process,
The function implements Bayesian estimation of non-structural parameters of each regime j(
) is carried out. The structural parameters: Number of Regimes(l), Thresholds(
), and autoregressive orders(
) must be known. Prior distributions where selected in order to get conjugate distributions.
Return a list type object of class “regime_model
”
Nj |
number of observations in each regime |
estimates |
list for each regime with confident interval and mean value of the parameters |
regime |
“ |
Chain |
if chain TRUE list type object with parameters chains. Necessary in mtarforecast. |
residuals |
matrix type object with residuals of the estimated model |
fitted.values |
matrix type object with fitted.values of the estimated model |
logLikj |
log-likelihood of each regime with final estimations |
data |
list type object $Yt and $Ut = (Zt,Xt) |
r |
final threshold value with acceptance percentage or r if known |
orders |
list type object with names (pj,qj,dj) known |
initial |
ini_obj given |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim #r known parameters = list(l = 2, orders = list(pj = c(1,1)), r = data$Sim$r) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 1000,chain = TRUE) print.regime_model(estim1) autoplot.regime_model(estim1,2) autoplot.regime_model(estim1,3) autoplot.regime_model(estim1,5) diagnostic_mtar(estim1) #r unknown parameters = list(l = 2,orders = list(pj = c(1,1))) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estim2 = mtarns(ini_obj = initial,niter = 500,chain = TRUE) print.regime_model(estim2) autoplot.regime_model(estim2,1) autoplot.regime_model(estim2,2) autoplot.regime_model(estim2,3) autoplot.regime_model(estim2,5) diagnostic_mtar(estim2)
data("datasim") data = datasim #r known parameters = list(l = 2, orders = list(pj = c(1,1)), r = data$Sim$r) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 1000,chain = TRUE) print.regime_model(estim1) autoplot.regime_model(estim1,2) autoplot.regime_model(estim1,3) autoplot.regime_model(estim1,5) diagnostic_mtar(estim1) #r unknown parameters = list(l = 2,orders = list(pj = c(1,1))) initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(pars = parameters)) estim2 = mtarns(ini_obj = initial,niter = 500,chain = TRUE) print.regime_model(estim2) autoplot.regime_model(estim2,1) autoplot.regime_model(estim2,2) autoplot.regime_model(estim2,3) autoplot.regime_model(estim2,5) diagnostic_mtar(estim2)
Compute estimation of number of regimes by NAIC or Carlin and Chib methodology for a MTAR model
mtarnumreg(ini_obj, level = 0.95, burn_m = NULL,niter_m = 1000, iterprev = 500, chain_m = FALSE, list_m = FALSE, NAIC = FALSE,ordersprev = list(maxpj = 2,maxqj = 0,maxdj = 0), parallel = FALSE)
mtarnumreg(ini_obj, level = 0.95, burn_m = NULL,niter_m = 1000, iterprev = 500, chain_m = FALSE, list_m = FALSE, NAIC = FALSE,ordersprev = list(maxpj = 2,maxqj = 0,maxdj = 0), parallel = FALSE)
ini_obj |
class “ |
level |
numeric type, confident interval for estimations. Default 0.95 |
burn_m |
numeric type, number of initial runs. Default NULL (10% of niter) |
niter_m |
numeric type, number of runs of MCMC. Default 1000 |
iterprev |
numeric type, number of runs for pseudo values. Default 500 |
chain_m |
logical type, if return chains of parameters. Default FALSE |
list_m |
logical type, if return list of regimes considered. Default FALSE |
NAIC |
logical type, if return estimation of number of regimes by NAIC (not run Carlin and Chip for l). Default FALSE |
ordersprev |
list type object with names (maxpj,maxqj,maxdj), maximum number of lags of each process consider in the pseudo values for each number of regimes considered . Default maxpj = 2,maxqj = 0, maxdj = 0 |
parallel |
logical type, if package |
Two proposals to identify or estimate the number of regimes l are implemented. Metropolised Carlin and Chib methodology takes into account the changing dimension in the parameter vector when the number of regimes changes, that proposal is Bayesian model selection. Other methodology consists in calculating the information criterion NAIC.
Return a list type object of class “regime_number
”
tsregime |
ini_obj$tsregime_obj |
list_m |
if list_m TRUE list of models considered |
m_chain |
if chain_m TRUE chains of m |
prop |
array of proportions each number of regimes have in each iteration |
estimates |
table of the proportions of m estimated |
final_m |
numeric type, final number of regimes estimated |
If NAIC TRUE add
NAIC |
list type of NAIC for each considered model |
NAIC_final_m |
numeric type, final number of regimes by this criteria |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(l0_max = 3),method = 'KUO') estim = mtarnumreg(ini_obj = initial,iterprev = 500,niter_m = 500, burn_m = 500, list_m = TRUE,ordersprev = list(maxpj = 2)) estim$final_m
data("datasim") data = datasim initial = mtarinipars(tsregime_obj = data$Sim, list_model = list(l0_max = 3),method = 'KUO') estim = mtarnumreg(ini_obj = initial,iterprev = 500,niter_m = 500, burn_m = 500, list_m = TRUE,ordersprev = list(maxpj = 2)) estim$final_m
Given an list object of the class “regime
” (length = l) with the model specification simulates N observations for a MTAR (Multivariate threshold autoregressive process) process.
mtarsim(N, Rg, r = NULL, Xt = NULL, Zt = NULL, seed = NULL)
mtarsim(N, Rg, r = NULL, Xt = NULL, Zt = NULL, seed = NULL)
N |
numeric type greater than 0. Number of observation to simulate. Not NULL |
Rg |
list type object of length l number of regimes of the process with names (R1, ..., Rl), each a class “ |
r |
numeric type of length l - 1, threshold value (within the range of Z_t). Default NULL |
Xt |
matrix |
Zt |
matrix |
seed |
numeric type, set a seed for simulation |
Given a list of length l of object of class “regime
” (model specification), it simulates observations of a MTAR process ($ Sim) and returns them an object of the class “mtarsim
”. We have an MTAR process is given by:
The simulation has 100 burn observations to stabilize the process. It is possible to simulate univariate (TAR, SETAR, etc.) or multivariate (VAR) processes, properly specifying the regime type object according to the model.
Return a list type object of class “mtarsim
”:
Sim |
object class “ |
Reg |
list type object with names (R1, ..., Rl) each one class “ |
pj |
vector of autoregressive orders in each regime |
qj |
vector of covariate lags orders in each regime |
dj |
vector of lags orders of threshold process in each regime |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
mtaregime
,
mtarns
,
mtarstr
,
mtarmissing
,
mtarnumreg
## get Ut data process Tlen = 500 Sigma_ut = 2 Phi_ut = list(phi1 = 0.3) R_ut = list(R1 = mtaregime(orders = list(p = 1,q = 0,d = 0),Phi = Phi_ut,Sigma = Sigma_ut)) Ut = mtarsim(N = Tlen,Rg = R_ut,seed = 124) Zt = Ut$Sim$Yt # Yt process k = 2 ## R1 regime Phi_R1 = list(phi1 = matrix(c(0.1,0.6,-0.4,0.5),k,k,byrow = TRUE)) Sigma_R1 = matrix(c(1,0,0,1),k,k,byrow = TRUE) R1 = mtaregime(orders = list(p = 1,q = 0,d = 0),Phi = Phi_R1,Sigma = Sigma_R1) ## R2 regime Phi_R2 = list(phi1 = matrix(c(0.3,0.5,0.2,0.7),2,2,byrow = TRUE)) Sigma_R2 = matrix(c(2.5,0.5,0.5,1),2,2,byrow = TRUE) R2 = mtaregime(orders = list(p = 1,q = 0,d = 0), Phi = Phi_R2,Sigma = Sigma_R2) ## create list of regime-type objects Rg = list(R1 = R1,R2 = R2) r = 0.3 # get the simulation datasim = mtarsim(N = Tlen,Rg = Rg,r = r,Zt = Zt,seed = 124) autoplot.tsregime(datasim$Sim,1) autoplot.tsregime(datasim$Sim,2)
## get Ut data process Tlen = 500 Sigma_ut = 2 Phi_ut = list(phi1 = 0.3) R_ut = list(R1 = mtaregime(orders = list(p = 1,q = 0,d = 0),Phi = Phi_ut,Sigma = Sigma_ut)) Ut = mtarsim(N = Tlen,Rg = R_ut,seed = 124) Zt = Ut$Sim$Yt # Yt process k = 2 ## R1 regime Phi_R1 = list(phi1 = matrix(c(0.1,0.6,-0.4,0.5),k,k,byrow = TRUE)) Sigma_R1 = matrix(c(1,0,0,1),k,k,byrow = TRUE) R1 = mtaregime(orders = list(p = 1,q = 0,d = 0),Phi = Phi_R1,Sigma = Sigma_R1) ## R2 regime Phi_R2 = list(phi1 = matrix(c(0.3,0.5,0.2,0.7),2,2,byrow = TRUE)) Sigma_R2 = matrix(c(2.5,0.5,0.5,1),2,2,byrow = TRUE) R2 = mtaregime(orders = list(p = 1,q = 0,d = 0), Phi = Phi_R2,Sigma = Sigma_R2) ## create list of regime-type objects Rg = list(R1 = R1,R2 = R2) r = 0.3 # get the simulation datasim = mtarsim(N = Tlen,Rg = Rg,r = r,Zt = Zt,seed = 124) autoplot.tsregime(datasim$Sim,1) autoplot.tsregime(datasim$Sim,2)
Estimate structural and non-structural parameters of a MTAR model when the number of regimes is fixed.
mtarstr(ini_obj, level = 0.95, niter = 1000, burn = NULL, chain = FALSE, r_init = NULL, parallel = FALSE)
mtarstr(ini_obj, level = 0.95, niter = 1000, burn = NULL, chain = FALSE, r_init = NULL, parallel = FALSE)
ini_obj |
class “ |
level |
numeric type, confident interval for estimations. Default 0.95 |
burn |
numeric type, number of initial runs. Default NULL (30% of niter) |
niter |
numeric type, number of runs of MCMC. Default 1000 |
chain |
logical type, if return chains of parameters. Default FALSE |
r_init |
numeric type of length l - 1. If r not known, starting value of the chain. Default NULL |
parallel |
logical type, if package |
If the number of regimes is known or fixed, we can estimate other structural parameters of the MTAR model: Thresholds(
), and autoregressive orders(
). Of course, the non-structural parameters are also estimated. The problem of estimation the autoregressive orders is addressed to the problem of Bayesian variable selection in regression using Gibbs Variable selection(GVS) or Kuo and Mallick Methodologies. Samples of the full conditional distribution for Threshold values are extracted using Random Walk Metropolis-Hastings Algorithm.
Return a list type object of class “regime_model
”
Nj |
number of observations in each regime |
estimates |
list for each regime with confident interval and mean value of the parameters |
regime |
“ |
Chain |
if chain TRUE list type object with parameters chains. Necessary in mtarforecast. |
residuals |
matrix type object with residuals of the estimated model |
fitted.values |
matrix type object with fitted.values of the estimated model |
logLikj |
log-likelihood of each regime with final estimations |
data |
list type object $Yt and $Ut = (Zt,Xt) |
r |
final threshold value estimation with acceptance percentage |
orders |
list type object with names (pj,qj,dj) final estimations |
initial |
ini_obj given |
Valeria Bejarano [email protected], Sergio Calderon [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim # KUO method initial = mtarinipars(tsregime_obj = data$Sim,method = 'KUO', list_model = list(pars = list(l = 2),orders = list(pj = c(2,2)))) estruc = mtarstr(ini_obj = initial,niter = 500,chain = TRUE) autoplot.regime_model(estruc,1) autoplot.regime_model(estruc,2) autoplot.regime_model(estruc,3) autoplot.regime_model(estruc,4) autoplot.regime_model(estruc,5) # method can also be 'SSVS'
data("datasim") data = datasim # KUO method initial = mtarinipars(tsregime_obj = data$Sim,method = 'KUO', list_model = list(pars = list(l = 2),orders = list(pj = c(2,2)))) estruc = mtarstr(ini_obj = initial,niter = 500,chain = TRUE) autoplot.regime_model(estruc,1) autoplot.regime_model(estruc,2) autoplot.regime_model(estruc,3) autoplot.regime_model(estruc,4) autoplot.regime_model(estruc,5) # method can also be 'SSVS'
print
a particular output for an object of a
particular class in a single command. This defines the S3 generic that
other classes and packages can extend.
print(object, ...)
print(object, ...)
object |
an object, whose class will determine the behaviour of autoplot |
... |
other arguments passed to specific methods |
print an output
Print estimates for the results of the mtarforecast functions.
## S3 method for class 'regime_forecast' print(object, ...)
## S3 method for class 'regime_forecast' print(object, ...)
object |
Object of class “ |
... |
Other print parameters that affect. |
Print estimates outputs corresponding to function “mtarforecast
” which return an object of class “regime_forecast
”.
Return to console.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data('datasim') estim = mtarns(mtarinipars(tsregime(datasim$Sim$Yt,datasim$Sim$Zt), list_model = list(pars = list(l = datasim$Sim$l,r = datasim$Sim$r, orders = list(pj = datasim$pj))))) estimU = mtarns(mtarinipars(tsregime(datasim$Sim$Zt), list_model = list(pars = list(l = 1,orders = list(pj = 1))))) forecast = mtarforecast(estim,h = 10,modelU = estimU) print.regime_model(forecast)
data("datasim") data('datasim') estim = mtarns(mtarinipars(tsregime(datasim$Sim$Yt,datasim$Sim$Zt), list_model = list(pars = list(l = datasim$Sim$l,r = datasim$Sim$r, orders = list(pj = datasim$pj))))) estimU = mtarns(mtarinipars(tsregime(datasim$Sim$Zt), list_model = list(pars = list(l = 1,orders = list(pj = 1))))) forecast = mtarforecast(estim,h = 10,modelU = estimU) print.regime_model(forecast)
Print estimates output of mtarmissing function.
## S3 method for class 'regime_missing' print(object, ...)
## S3 method for class 'regime_missing' print(object, ...)
object |
Object of class “ |
... |
Other plotting parameters to affect the plot. |
Print the estimates for the outputs corresponding to the function “mtarmissing
” which return an object of class “regime_missing
”.
Return to console.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data('missingest') print.regime_missing(missingest)
data('missingest') print.regime_missing(missingest)
Print estimates for the results of the mtarns and mtarstr functions.
## S3 method for class 'regime_model' print(object, ...)
## S3 method for class 'regime_model' print(object, ...)
object |
Object of class “ |
... |
Other print parameters that affect. |
Print estimates outputs corresponding to functions “mtarns
” and “mtarstr
” which return an object of class “regime_model
”.
Return to console.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim$Sim$Zt parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE,burn = 500) print.regime_model(estim1)
data("datasim") data = datasim$Sim$Zt parameters = list(l = 1,orders = list(pj = 1)) initial = mtarinipars(tsregime_obj = tsregime(data), list_model = list(pars = parameters)) estim1 = mtarns(ini_obj = initial,niter = 500,chain = TRUE,burn = 500) print.regime_model(estim1)
Print estimates for the results of the mtarnumreg function.
## S3 method for class 'regime_number' print(object, ...)
## S3 method for class 'regime_number' print(object, ...)
object |
Object of class “ |
... |
Other print parameters that affect. |
Print estimates outputs corresponding to function “mtarnumreg
” which return an object of class “regime_number
”.
Return to console.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim_numreg") print.regime_number(datasim_numreg)
data("datasim_numreg") print.regime_number(datasim_numreg)
Print the structure of a object class “tsregime
”.
## S3 method for class 'tsregime' print(object, ...)
## S3 method for class 'tsregime' print(object, ...)
object |
Object of class “ |
... |
Other parameters that affect print. |
Print the structure of a object class “tsregime
”.
Return to console.
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
data("datasim") data = datasim print.tsregime(data$Sim)
data("datasim") data = datasim print.tsregime(data$Sim)
Auxiliary function of some functions in the MTAR package
prodB(x)
prodB(x)
x |
list of objects to make the product |
float number result of the product
Auxiliary function of some functions in the MTAR package
repM(M,r)
repM(M,r)
M |
matrix type object |
r |
integer indicating the length of the list |
List of matrix of length r
tsregime
” for some dataThe function tsregime is used to create time-series-regime objects.
tsregime(Yt, Zt = NULL, Xt = NULL, r = NULL)
tsregime(Yt, Zt = NULL, Xt = NULL, r = NULL)
Yt |
matrix |
Zt |
matrix |
Xt |
matrix |
r |
numeric type, threshold value (within the range of |
Create a class “tsregime
” object composed of: and
stochastics processes such that
',
and
is a univariate process. Where
follows a MTAR model with threshold variable
Missing data is allowed for processes ,
and
(can then be estimated with “
mtarmissing
” function). In the case of known r, the output returns the percentages of observations found in each regimen.
Return a list type object of class “tsregime
”:
l |
number of regimes |
nu |
number of covariates variables |
Yt |
stochastic output process |
Xt |
stochastic covariate process (if enter) |
Zt |
stochastic threshold process (if enter) |
N |
number of observations |
k |
number of variables |
If r known:
r |
threshold value |
Ind |
numeric type, number of the regime each observation belong |
Summary_r |
data.frame type, number and proportion of observations in each regime |
Valeria Bejarano [email protected] & Andrey Rincon [email protected]
Calderon, S. and Nieto, F. (2017) Bayesian analysis of multivariate threshold autoregress models with missing data. Communications in Statistics - Theory and Methods 46 (1):296–318. doi:10.1080/03610926.2014.990758.
mtaregime
,
mtarinipars
,
mtarsim
data("datasim") yt = datasim$Sim Yt = yt$Yt Zt = yt$Zt (datos = tsregime(Yt,Zt)) autoplot.tsregime(datos,1) autoplot.tsregime(datos,2)
data("datasim") yt = datasim$Sim Yt = yt$Yt Zt = yt$Zt (datos = tsregime(Yt,Zt)) autoplot.tsregime(datos,1) autoplot.tsregime(datos,2)