mbsts_function {mbsts}R Documentation

Main function for the multivariate Bayesian structural time series (MBSTS) model

Description

The MBSTS model uses MCMC to sample from the posterior distribution of a MBSTS model. The model is given by

y=\mu+\tau+\omega+\beta X+\epsilon,

where \mu, \tau, \omega, \beta X, and \epsilon denote the trend component, the seasonal component, the cycle component, the regression component, and the error term, respectively. Note that, without a regression component, the MBSTS model is an ordinary state space time series model. The predictors and response variables in the MBSTS model are designed to be contemporaneous. Lags and differences can be generated by manipulating the predictor matrix. The "spike-and-slab" prior is used for the regression component of models, which enables feature selection among a large number of features.

Usage

mbsts_function(
  Y,
  Xtrain,
  STmodel,
  ki,
  pii,
  b = NULL,
  v0,
  kapp = 0.01,
  R2 = 0.8,
  v = 0.01,
  ss = 0.01,
  mc = 500,
  burn = 50
)

## S4 method for signature 'array'
mbsts_function(
  Y,
  Xtrain,
  STmodel,
  ki,
  pii,
  b = NULL,
  v0,
  kapp = 0.01,
  R2 = 0.8,
  v = 0.01,
  ss = 0.01,
  mc = 500,
  burn = 50
)

Arguments

Y

A (n*m)-dimensional matrix containing multiple target series, where n is the number of observations and m is the number of target series.

Xtrain

A (n*K)-dimensional matrix containing all candidate predictor series for each target series. K=\sum k_i is the number of all candidate predictors for all target series. The first k_1 variables are the set of candidate predictors for the first target series, and the next k_2 variables are the set of candidate predictors for the second target series, etc. Note that, one variable can appear in the X.star several times, since different target series can contain the same candidate predictors.

STmodel

A state space model of SSmodel class returned by tsc.setting.

ki

A vector of integer values denoting the acumulated number of predictors for target series. For example, if there are three target series where the first has 8 predictors, the second has 6 predictors, and the third has 10 predictors, then the vector is c(8,14,24).

pii

A vector describing the prior inclusion probability of each candidate predictor.

b

NULL or a vector describing the prior means of regression coefficients. The default value is NULL.

v0

A numerical value describing the prior degree of freedom of the inverse Wishart distribution for \Sigma_\epsilon.

kapp

A scalar value describing the number of observations worth of weight on the prior mean vector. The default value is 0.01.

R2

A numerical value taking value in [0,1], describing the expected percentage of variation of Y to be explained by the model. The default value is 0.8.

v

A numerical value describing the prior degree of freedom of the inverse Wishart distribution for (\Sigma_\mu,\Sigma_\delta,\Sigma_\tau,\Sigma_\omega). The default value is 0.01.

ss

A numerical value describing the prior scale matrix of the inverse Wishart distribution for (\Sigma_\mu,\Sigma_\delta,\Sigma_\tau,\Sigma_\omega). The default value is 0.01.

mc

A positive integer giving the desired number of MCMC draws. The default value is 500.

burn

A positive integer giving the number of initial MCMC draws to be discarded. The default value is 50.

Value

An object of mbsts class

Author(s)

Jinwen Qiu qjwsnow_ctw@hotmail.com Ning Ning patricianing@gmail.com

References

Qiu, Jammalamadaka and Ning (2018), Multivariate Bayesian Structural Time Series Model, Journal of Machine Learning Research 19.68: 1-33.

Ning and Qiu (2021), The mbsts package: Multivariate Bayesian Structural Time Series Models in R.

Jammalamadaka, Qiu and Ning (2019), Predicting a Stock Portfolio with the Multivariate Bayesian Structural Time Series Model: Do News or Emotions Matter?, International Journal of Artificial Intelligence, Vol. 17, Number 2.


[Package mbsts version 3.0 Index]