Compares response half-lives across model specifications
Source:R/compare.R
compare_half_life_response.RdSummarises across model specifications the first horizons at which posterior response draws fall to a specified fraction of a reference response.
Arguments
- ...
Posterior model objects or a named list of model objects.
- horizon
Maximum horizon used when
objectis a posterior model object. IfNULL(default), resolves to 20 periods.- type
Response type for posterior model objects:
"irf"or"cdm".- variables
Response variables to include.
- shocks
Structural shocks to include.
- variable
Deprecated. Use
variablesinstead.- shock
Deprecated. Use
shocksinstead.- fraction
Fraction of the reference level used to define the half-life.
- baseline
Reference level:
"peak"or"initial".- absolute
If
TRUE, compute half-lives using absolute responses.- probability
Probability mass of the equal-tailed credible interval.
- scale_by
Optional scaling mode for CDMs.
- scale_var
Optional scaling variable specification.
Value
A bsvar_post_tbl combining half-life summary results across
models, with a model column identifying each model 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)
comp <- compare_half_life_response(m1 = post1, m2 = post2, horizon = 3)
head(comp)
#> # A tibble: 6 × 22
#> model object_type variable shock fraction baseline mean_half_life
#> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl>
#> 1 m1 half_life_irf ttr ttr 0.5 peak 1
#> 2 m1 half_life_irf ttr gs 0.5 peak NA
#> 3 m1 half_life_irf ttr gdp 0.5 peak 1.5
#> 4 m1 half_life_irf gs ttr 0.5 peak 1.75
#> 5 m1 half_life_irf gs gs 0.5 peak 1
#> 6 m1 half_life_irf gs gdp 0.5 peak NA
#> # ℹ 15 more variables: median_half_life <dbl>, sd_half_life <dbl>,
#> # lower_half_life <dbl>, upper_half_life <dbl>, reached_prob <dbl>,
#> # 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>