Skip to contents

Plot posterior draws for a given parameter against a known marginal prior distribution.

Usage

plot_prior_posterior(
  draws_long,
  prior_params,
  fit_id_col = "forecast_date",
  model_type_col = "model_type",
  variable_name = ".variable",
  value_name = ".value",
  row_facet = "location",
  custom_x_transform = list(),
  custom_xlim = list()
)

Arguments

draws_long

long-format posterior draws, as the output of tidybayes::gather_draws() with auxiliary metadata columns as below.

prior_params

Named list of prior hyperparameter values, as the output of wwinference::get_params()

fit_id_col

Name of a column in draws_long that uniquely identifies individual model fits within a facet. Default "forecast_date".

model_type_col

Name of a column in draws_long that identifies model types, so that scale_fill_model() can be applied. Default "model_type".

variable_name

Name for the variable column. Default ".variable", matching tidybayes::gather_draws().

value_name

Name for the value column. Default ".value", matching tidybayes::gather_draws().

row_facet

Column to facet rows by. Default "location".

custom_x_transform

Optional named list mapping parameter names to custom x transforms to use for that parameter's panels in the plot. If a parameter name is not matched, the identity transform will be used. Default list(), which implies using the identity transform for all panels.

custom_xlim

Optional named list mapping parameter names to vectors specifying custom x limits to use for that parameter's panels in the plot. If a parameter name is not matched, x limits will be deferred to ggplot. Default list(), which implies deferring limits for all parameters.

Value

The plot.