bsvars / bsvarSIGNs

Bayesian SVARs with Sign, Zero, and Narrative Restrictions
http://bsvars.org/bsvarSIGNs/
Other
10 stars 2 forks source link

Zero restrictions at different horizons #52

Closed devproglab closed 1 week ago

devproglab commented 1 week ago

Hi! I am trying to specify & estimate a SVAR-model wih zero and sign restrictions. My model has 5 variables and I construct the restrictions in the following way:

sign_irf       = matrix(NA, 5, 5)
sign_irf[, 1]  = c(0, NA, -1, 1, 1) 
sign_irf[, 2]  = c(1, NA, -1, NA, NA) 
sign_irf[, 3]  = c(NA, NA, NA, NA, 1)
sign_irf       = array(sign_irf, dim = c(5, 5, 5))
sign_irf[1,,2:5] <- NA

However, specify_bsvarSIGN$new() returns an error, even though I explicitly enable zero restrictions only on impact: Zero restrictions are not allowed for horizons >= 1 I've looked at the source code and noticed that the error is thrown regardless of the timing of the zero restriction. Is this the expected behaviour?

donotdespair commented 1 week ago

Hi @devproglab Thanks for reaching out!

@adamwang15 could you please address this one 😸 Thanks!

Gretings Everybody! T

adamwang15 commented 1 week ago

Hi @devproglab and @donotdespair

You are right! This is not the expected behaviour. The source code should be test = sign_irf[,, 2:h] instead and only test horizons >= 1. Unfortunately, I could not think of a simple workaround now, but we will update this in the next version soon. Thanks for pointing this out!

Cheers, Adam

adamwang15 commented 1 week ago

@devproglab

Alternatively, you can install the development version, which should work fine now:

devtools::install_github("bsvars/bsvarSIGNs")

devproglab commented 1 week ago

@adamwang15 Got it, will do.

Really appreciate the package, btw. Thanks a lot!