Compares posterior restriction probabilities across model specifications
Source:R/compare.R
compare_restrictions.RdEvaluates the same identifying restrictions for two or more posterior model objects and combines their posterior probabilities in a common table.
Value
A bsvar_post_tbl containing posterior restriction
probabilities across models, with a model column identifying each
specification.
Examples
data(us_fiscal_lsuw, package = "bsvars")
spec <- bsvars::specify_bsvar$new(us_fiscal_lsuw, p = 1)
#> The identification is set to the default option of lower-triangular structural matrix.
post1 <- bsvars::estimate(spec, S = 5, show_progress = FALSE)
post2 <- bsvars::estimate(spec, S = 5, show_progress = FALSE)
r <- list(irf_restriction("gdp", "gdp", 0, sign = 1))
comp <- compare_restrictions(m1 = post1, m2 = post2, restrictions = r)
head(comp)
#> # A tibble: 2 × 23
#> model restriction_type restriction variable shock horizon relation
#> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 m1 irf_sign irf[gdp,gdp,0]>0 gdp gdp 0 >0
#> 2 m2 irf_sign irf[gdp,gdp,0]>0 gdp gdp 0 >0
#> # ℹ 16 more variables: posterior_prob <dbl>, mean <dbl>, median <dbl>,
#> # lower <dbl>, upper <dbl>, object_type <chr>, analysis_type <chr>,
#> # interval_probability <dbl>, interval_method <chr>, scale_by <chr>,
#> # scale_var <chr>, scale_factor <dbl>, units <chr>, source_package <chr>,
#> # source_version <chr>, n_draws <int>