diff --git a/R/estimate.R b/R/estimate.R index 8cca0fa..e58b3f9 100644 --- a/R/estimate.R +++ b/R/estimate.R @@ -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) diff --git a/R/specify.R b/R/specify.R index 2652dd1..cd592b9 100644 --- a/R/specify.R +++ b/R/specify.R @@ -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 } @@ -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 } @@ -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 } diff --git a/src/bsvars_sign.cpp b/src/bsvars_sign.cpp index c43cbde..33470ba 100644 --- a/src/bsvars_sign.cpp +++ b/src/bsvars_sign.cpp @@ -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(); diff --git a/src/restrictions_narrative.cpp b/src/restrictions_narrative.cpp index 805bb66..ea4a57a 100644 --- a/src/restrictions_narrative.cpp +++ b/src/restrictions_narrative.cpp @@ -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);