prior_posterior {HuraultMisc}R Documentation

Compare prior to posterior

Description

Usage

combine_prior_posterior(prior, post, pars = NULL, match_exact = TRUE)

plot_prior_posterior(
  prior,
  post,
  pars = NULL,
  match_exact = TRUE,
  lb = "5%",
  ub = "95%"
)

compute_prior_influence(
  prior,
  post,
  pars = NULL,
  match_exact = TRUE,
  remove_index_prior = TRUE
)

plot_prior_influence(prior, post, pars = NULL, match_exact = TRUE)

check_model_sensitivity(prior, post, pars = NULL)

Arguments

prior

Dataframe of prior parameter estimates. The dataframe is expected to have columns Variable, Mean. For plot_prior_posterior(), the columns ⁠5%⁠ and ⁠95%⁠ should also be present. For compute_prior_influence() and plot_prior_influence(), the columns Index and sd should also be present.

post

Dataframe of posterior parameter estimates, with same columns as prior.

pars

Vector of parameter names to plot. Defaults to all parameters presents in post and prior.

match_exact

Logical indicating whether parameters should be matched exactly (e.g. p does not match ⁠p\[1\]⁠).

lb

Name of the column in prior and post corresponding to lower bound of error bar

ub

Name of the column in prior and post corresponding to upper bound of error bar

remove_index_prior

Whether to remove the index variable for prior except the first one. This is useful if a parameter with multiple index have the same prior distribution (e.g. with subject parameters, when prior does not contain as many subjects as post for computational reasons).

Details

Value

Note

For plot_prior_posterior, parameters with the same name but different indices are plotted together. If their prior distribution is the same, it can be useful to only keep one index in prior. If not, we can use match_exact = FALSE to plot parameter[1] and parameter[2] separately.

References

M. Betancourt, “Towards a Principled Bayesian Workflow”, 2018.


[Package HuraultMisc version 1.1.1 Index]