R/mlag2.R

Defines functions mlag2

mlag2 <- function(FY, plag = 2){
  for (i in 1:plag) {
    if (i == 1){
      ans <- apply(FY, 2, dplyr::lag, n = i)
    }else {
      ans <- cbind(ans, apply(FY, 2, dplyr::lag, n = i))
    }
  }
  return(ans)
}

Try the FAVAR package in your browser

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

FAVAR documentation built on May 28, 2022, 1:20 a.m.