R/B.R

Defines functions B

Documented in B

"Bcoef" <-
function(x){
  if(!(class(x)=="varest")){
    stop("\nPlease provide an object of class 'varest', generated by 'var()'.\n")
  }
  y.names <- colnames(x$datamat[, c(1 : x$K)])
  Z <- x$datamat[, -c(1 : x$K)]
  B <- matrix(0, nrow = x$K, ncol = ncol(Z))
  if(is.null(x$restriction)){
    for(i in 1 : x$K){
      B[i, ] <- coef(x$varresult[[i]])
    }
  }else if(!(is.null(x$restriction))){
    for(i in 1 : x$K){
      restrictions <- x$restrictions
      restrictions[i, restrictions[i, ] == TRUE] <- coef(x$varresult[[i]])
      temp <- restrictions[i, ]
      B[i, ] <- temp
    }
  }
  colnames(B) <- colnames(Z)
  rownames(B) <- y.names
  return(B)
}
B <- function(x){
  .Deprecated("Bcoef", package = "vars", msg = "Function 'B' is deprecated; use 'Acoef' instead.\nSee help(\"vars-deprecated\") and help(\"B-deprecated\") for more information.")
  Bcoef(x = x)
}
cheaton/vars2 documentation built on Oct. 1, 2018, 12:22 a.m.