R/bootStateSpace-formula-var-dot.R

Defines functions .FormulaVAR

.FormulaVAR <- function(p,
                        intercept) {
  formula <- lapply(
    X = seq_len(p),
    FUN = function(i) {
      terms <- paste0(
        "(",
        "beta_",
        i,
        "_",
        seq_len(p),
        " * eta_",
        seq_len(p),
        ")",
        collapse = " + "
      )
      paste0(
        "eta_",
        i,
        " ~ ",
        terms
      )
    }
  )
  if (intercept) {
    formula <- lapply(
      X = seq_len(length(formula)),
      FUN = function(i) {
        paste0(
          formula[[i]],
          " + ",
          "alpha_",
          i,
          "_1"
        )
      }
    )
  }
  formula
}

Try the bootStateSpace package in your browser

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

bootStateSpace documentation built on April 4, 2025, 1:35 a.m.