R/XFcstTrue.R

Defines functions XFcstTrue

Documented in XFcstTrue

#' Forecast for covariate matrix: using true generating process
#'
#' @description Forecast using the true X process specified, depending on the data type (uncorrelated, correlated).
#'
#' It is the noise-free 'forecaster', and part of \code{XintvCorr} or \code{XintvSimple} for intervention. (??)
#'
#' @details This function (including the simple, and 2 correlated) are essentially the "no intervention" part of the
#' intervention using true process - since I have produced those functions first, this one is to set the baseline for forecasting
#' because in reality it's impossible to know the true process. In another word, this is the best forecast can be achieved ever.
#'
#'
#'
#' @param datatype a string. Choose from 'simple', 'block1', 'block2'.
#' @param horizon a number. Forecast horizon.
#' @param parameters.of.X a list. The one that has been used for simulation.
#' @param Xinput a matrix. The original training X matrix for forecast, DAT$X.for.fcst (10 series)
#'
#' @return a matrix
#'
#' \item{xtrue.fcst}{a matrix. Forecast values for each series produced by true method.}
#'
#' @export
#'
#' @examples
#'#' ##

XFcstTrue <- function(datatype,
                      horizon,
                      parameters.of.X,
                      Xinput){

  if (datatype == 'simple'){
    xtrue.fcst <- XTrueSimple(horizon = horizon,
                              sigmax = 0.001,
                              p = parameters.of.X$nseries,
                              ARmatrix = parameters.of.X$A,
                              Xinput = Xinput,
                              nsize = parameters.of.X$nsize)


  }else if (datatype == 'block1'){
    xtrue.fcst <- XTrueCorr(horizon = horizon,
                            sigmax = 0.001,
                            A.block = parameters.of.X$A.block,
                            p.block = parameters.of.X$p.block,
                            Xinput = Xinput,
                            nsize = parameters.of.X$nsize)




  }else if (datatype == 'block2'){
    xtrue.fcst <- XTrueCorr2(horizon = horizon,
                             sigmax = 0.001,
                             p.block = parameters.of.X$p.block,
                             A.block = parameters.of.X$A.block,
                             Xinput = Xinput,
                             nsize = parameters.of.X$nsize)

  }else{
    cat('meh')
  }

  return(list(xtrue.fcst = xtrue.fcst))

}
yymmhaha/PackPaper1 documentation built on May 24, 2019, 8:55 a.m.