Skip to content

Commit

Permalink
subtract lags from narrative restrictions #31
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwang15 committed Jul 16, 2024
1 parent 719c2db commit 3a6f5a4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion R/estimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ estimate.BSVARSIGN = function(specification, S, thin = 1, show_progress = TRUE)
Z = get_Z(identification$sign_irf)
sign = identification$sign_irf
sign[is.na(sign)] = 0
narrative = identification$sign_narrative
narrative[, 5] = narrative[, 5] - p

# estimation
qqq = .Call(`_bsvarSIGNs_bsvar_sign_cpp`, S, p, Y, X,
identification$VB, sign, identification$sign_narrative,
identification$VB, sign, narrative,
identification$sign_relation, Z, prior,
starting_values, show_progress, thin, max_tries)

Expand Down
6 changes: 3 additions & 3 deletions R/specify.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ specify_identification_bsvarSIGN = R6::R6Class(
missing_all = FALSE
}
if (missing(sign_narrative)) {
sign_narrative = matrix(c(0, 1, 1, 1, 1, 0), ncol = 6, nrow = 1)
sign_narrative = matrix(c(0, 1, 1, 1, 1, 1), ncol = 6, nrow = 1)
} else {
missing_all = FALSE
}
Expand Down Expand Up @@ -558,7 +558,7 @@ specify_identification_bsvarSIGN = R6::R6Class(
missing_all = FALSE
}
if (missing(sign_narrative)) {
sign_narrative = matrix(c(0, 1, 1, 1, 1, 0), ncol = 6, nrow = 1)
sign_narrative = matrix(c(0, 1, 1, 1, 1, 1), ncol = 6, nrow = 1)
} else {
missing_all = FALSE
}
Expand Down Expand Up @@ -683,7 +683,7 @@ specify_bsvarSIGN = R6::R6Class(
missing_all = FALSE
}
if (missing(sign_narrative)) {
sign_narrative = matrix(c(0, 1, 1, 1, 1, 0), ncol = 6, nrow = 1)
sign_narrative = matrix(c(0, 1, 1, 1, 1, 1), ncol = 6, nrow = 1)
} else {
missing_all = FALSE
}
Expand Down
2 changes: 1 addition & 1 deletion src/bsvars_sign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Rcpp::List bsvar_sign_cpp(
posterior_shocks.slice(s) = shocks;

// Check for user interrupts
if (s % 200 == 0) checkUserInterrupt();
if (s % 1 == 0) checkUserInterrupt();

// Increment progress bar
if (any(prog_rep_points == s)) bar.increment();
Expand Down
4 changes: 2 additions & 2 deletions src/restrictions_narrative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ double weight_narrative(
const arma::cube& irf
) {

const int M = 1e+04; // number of draws to approximate normal distribution
const int M = 1e+3; // number of draws to approximate normal distribution

double n_success = 1.0e-15;
double n_success = 1.0e-6;

cube Z(irf.n_rows, sign_narrative.col(5).max() + 1, M, fill::randn);
// cube Z(irf.n_rows, T, M, fill::randn);
Expand Down

0 comments on commit 3a6f5a4

Please sign in to comment.