R/XgenCorr2.R

Defines functions XgenCorr2

Documented in XgenCorr2

#' Generate blockly correlated VAR time series (type 2)
#'
#' @description Generate vector autoregression time series with 2 blockly correlated structure
#'
#' @details This function is based on \code{XgenSimple}. 2 blocks, hence need specification for each block, and arguments \code{p.block,
#' x0.block, A.block} should have length of 2.
#' It is recommended to use \code{coef.mat} to generate the AR coefficient matrices.
#'
#' @param p.block a list of 2 numbers. Number of covariates for each block. Default is 6, 4 so they form a 10 series X.
#' @param x0.block a list of 2 sublists. Each sublist contains vectors as the initial values
#' @param A.block a list of 2 sublists. Each sublist contains AR coefficient matrices.
#' @param t a number. Length of series, including the initial lags.
#' @param sigmax a number. Standard deviation of noise of x.
#'
#' @return a matrix
#'
#' \item{bigX}{The combined matrix of 2 individual submatrices}
#'
#' @export
#'
#' @examples
#' # see example in XgenCorr().



XgenCorr2 <- function(p.block, x0.block, A.block, t, sigmax){


  X1 <- XgenSimple(p = p.block$p1, A = A.block$block1, x0 = x0.block$x10, t = t, sigmax = sigmax)$X
  X2 <- XgenSimple(p = p.block$p2, A = A.block$block2, x0 = x0.block$x20, t = t, sigmax = sigmax)$X

  # put together
  bigX <- cbind(X1, X2)
  return(bigX)
}
yymmhaha/PackPaper1 documentation built on May 24, 2019, 8:55 a.m.