3
$\begingroup$

I wanna determine the number of lags for a Baysian VAR/FAVAR model, which I implement based on R's VARsignR package. To compute the AIC/BIC I'd need the residuals of the model estimation. How can I extract these to compute the two selection criterion? There is no such object provided as part of uhlig.reject.

model <- uhlig.reject(Y= data, nlags=3, draws=200, subdraws=200, nkeep=1000, KMIN=1,KMAX=2, constrained=constr, constant=FALSE, steps=25)

Later I wanted to compute the criteria according to:

BIC <- function(model) {
  
  ssr <- sum(model$residuals^2)
  t <- length(model$residuals)
  npar <- length(model$coef)
  
  return(
    round(c("p" = npar - 1,
          "BIC" = log(ssr/t) + npar * log(t)/t,
          "R2" = summary(model)$r.squared), 4)
  )
}

Any thoughts on this? Is there maybe a smarter way for lag selection in this context? Papers are pretty vague here.

$\endgroup$
1
  • 1
    $\begingroup$ I don’t have time right now to write full answer but I think you could just use varsoc. If I am not mistaken varsoc command estimates auxiliary var based on data and gives you nice overview of optimal lags by all common criteria (aic, bic etc) $\endgroup$
    – 1muflon1
    Commented Mar 13, 2021 at 22:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.