Skip to contents

Transforms posterior draws of cumulative dynamic multipliers into probabilities that threshold or pairwise response inequalities are satisfied.

Usage

hypothesis_cdm(object, ...)

# Default S3 method
hypothesis_cdm(object, ...)

# S3 method for class 'PosteriorCDM'
hypothesis_cdm(
  object,
  variables = NULL,
  shocks = NULL,
  variable = NULL,
  shock = NULL,
  horizon,
  relation = c("<", "<=", ">", ">=", "=="),
  value = 0,
  compare_to = NULL,
  absolute = FALSE,
  probability = 0.9,
  draws = FALSE,
  model = "model1",
  ...
)

# S3 method for class 'PosteriorBSVAR'
hypothesis_cdm(
  object,
  variables = NULL,
  shocks = NULL,
  variable = NULL,
  shock = NULL,
  horizon,
  relation = c("<", "<=", ">", ">=", "=="),
  value = 0,
  compare_to = NULL,
  absolute = FALSE,
  probability = 0.9,
  draws = FALSE,
  model = "model1",
  scale_by = c("none", "shock_sd"),
  scale_var = NULL,
  ...
)

Arguments

object

A posterior model object or a PosteriorCDM array.

...

Additional arguments passed to computation methods.

variables

Response variable selection on the left-hand side (character or integer vector).

shocks

Shock selection on the left-hand side (character or integer vector).

variable

Deprecated. Use variables instead.

shock

Deprecated. Use shocks instead.

horizon

Horizon selection on the left-hand side.

relation

Comparison operator.

value

Scalar comparison value for threshold statements.

compare_to

Optional right-hand-side response specification with elements variable, shock, and horizon.

absolute

If TRUE, compare absolute responses.

probability

Probability mass of the equal-tailed credible interval for the posterior difference.

draws

If TRUE, return draw-level gaps and indicators.

model

Label identifying the model specification.

scale_by

Optional scaling mode for CDMs.

scale_var

Optional scaling variable specification.

Value

A bsvar_post_tbl with columns model, object_type, variable, shock, horizon, relation, posterior_prob, mean_gap, median_gap, lower_gap, and upper_gap. When draws = TRUE, columns draw, gap, and satisfied replace the summary statistics. Additional columns rhs_variable, rhs_shock, rhs_horizon, rhs_value, and absolute describe the right-hand side.

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.
post <- bsvars::estimate(spec, S = 5, show_progress = FALSE)

h <- hypothesis_cdm(post, variables = "gdp", shocks = "gdp",
                    horizon = 0:2, relation = ">", value = 0)
print(h)
#> # A tibble: 3 × 26
#>   model  object_type variable shock horizon relation posterior_prob mean_gap
#>   <chr>  <chr>       <chr>    <chr>   <dbl> <chr>             <dbl>    <dbl>
#> 1 model1 cdm         gdp      gdp         0 >                     1    0.344
#> 2 model1 cdm         gdp      gdp         1 >                     1    0.938
#> 3 model1 cdm         gdp      gdp         2 >                     1    1.72 
#> # ℹ 18 more variables: median_gap <dbl>, lower_gap <dbl>, upper_gap <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>,
#> #   rhs_variable <chr>, rhs_shock <chr>, rhs_horizon <dbl>, rhs_value <dbl>,
#> #   absolute <lgl>