R/mbsts_class.R

#' @title Constructor for the MBSTS model
#' @author Jinwen Qiu \email{qjwsnow_ctw@hotmail.com} Ning Ning \email{patricianing@gmail.com}
#' @description This class constructor build an object of MBSTS class, encoding a state space model together with a uni- or multi-variate time series, which is central to all the package's functionality. One implements the MBSTS model by specifying some or all of its basic components.
#' 
#' @slot Xtrain A (\eqn{n*K})-dimensional matrix containing all candidate predictor series for each target series. \eqn{K=\sum k_i} is the number of all candidate predictors for all target series. The first \eqn{k_1} variables are the set of candidate predictors for the first target series, and the next \eqn{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.
#' @slot Ind A (\eqn{K*}(mc-burn))-dimensional matrix containing MCMC draws of the indicator variable. If X.star is null, it will not be returned.
#' @slot beta.hat A (\eqn{K*}(mc-burn))-dimensional matrix containing MCMC draws of regression coefficients. If X.star is null, it will not be returned.
#' @slot B.hat A (\eqn{K*m*}(mc-burn))-dimensional array generated by combining beta.hat for all target series. If X.star is null, it will not be returned.
#' @slot ob.sig2 A (\eqn{m*m*}(mc-burn))-dimensional array containing MCMC draws of variance-covariance matrix for residuals.
#' @slot States A (\eqn{n*m1*}(mc-burn))-dimensional array containing MCMC draws of all time series components, where \eqn{m1} is the number of all time series components. If the STmodel is null, it will not be returned.
#' @slot st.sig2 A (\eqn{K*}(mc-burn))-dimensional matrix containing MCMC draws of variances for time series components. If the STmodel is null, it will not be returned.
#' @slot 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 \eqn{8} predictors, the second has \eqn{6} predictors, and the third has \eqn{10} predictors, then the vector is c(\eqn{8,14,24}).
#' @slot ntrain A numerical value for number of observations.
#' @slot mtrain A numerical value for number of response variables.


#'@references
#'\Ning2021
#'



#' @export 
#' @rdname mbsts
setClass(
    "mbsts",
    slots=c(
        Xtrain="array",
        Ind="array",
        beta.hat="array", 
        B.hat="array",
        ob.sig2="array",
        States="array",
        st.sig2="array",
        ki="array",
        ntrain="numeric",
        mtrain="numeric"
    ),
    prototype=prototype(
        Xtrain=array(data=numeric(0),dim=c(0,0)),
        Ind=array(data=numeric(0),dim=c(0,0)),
        beta.hat=array(data=numeric(0),dim=c(0,0)),
        B.hat=array(data=numeric(0),dim=c(0,0,0)),
        ob.sig2=array(data=numeric(0),dim=c(0,0,0)),
        States=array(data=numeric(0),dim=c(0,0,0)),
        st.sig2=array(data=numeric(0),dim=c(0,0)),
        ki=array(data=numeric(0),dim=c(0,0)),
        ntrain=as.double(NA),
        mtrain=as.double(NA)
    )
)

Try the mbsts package in your browser

Any scripts or data that you put into this service are public.

mbsts documentation built on Jan. 7, 2023, 9:07 a.m.