bsvars / bsvarSIGNs

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

Error when mixing zero and sign restrictions #56

Open giannilmbd opened 2 days ago

giannilmbd commented 2 days ago

Hi,

I get this error

**************************************************|
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Error in estimate.BSVARSIGN(specification, S = n_draws) : 
  matrix multiplication: incompatible matrix dimensions: 0x0 and 6x1

when I mix sign and zero restrictions eg like

sr <- matrix(c(
#"House.Price","CPI","ois3mrg","GDP",'YCslope','CHTWI'
  1 ,   NA, NA,  NA,-1,NA,#"House.Price"
  NA,   1, 0, NA,-1,NA,# "CPI'
  NA,   NA,  1,  NA,NA,NA,# ois3mrg
  NA,   NA, 0,  1,-1,-NA,# "GDP"
  NA,   1,  -1,  1,1,NA,# "YCslope
   NA,   NA,  1,  NA,1,1 # CHTWI
), nrow = n_var, byrow = TRUE)

Note that I also have narrative restrictions, in case it matters.

When I replace the 0s with NA, the program works fine.

I'm using

> packageVersion("bsvarSIGNs")
[1] ‘1.0.1’
> packageVersion("bsvars")
[1] ‘3.1’

Thanks and best Gianni

giannilmbd commented 1 day ago

Hi, I've experimented and if the column (and corresponding row) with the zeros is moved first (i.e. order of variables and shocks changed) the code works as expected. Cheers Gianni

giannilmbd commented 1 day ago

Sorry for this sequence of messages... Just learning how the code works.

It appears that while putting the column with zeros first makes the code run without error messages, the IRFs produced under this constellation have no confidence bands. Reverting to NA in place of the 0s produces a whole non-degenerate distribution of the posterior.

I understand from this experiment that indeed there is some problem in the mixture of zeros and sign restrictions in certain cases.

Cheers

Gianni