Plot estimates from models

plot_models(
  model_list,
  samples,
  inference,
  parameter,
  plot_type = "base",
  prior = FALSE,
  conditional = FALSE,
  order = NULL,
  transformation = NULL,
  transformation_arguments = NULL,
  transformation_settings = FALSE,
  par_name = NULL,
  formula_prefix = TRUE,
  ...
)

Arguments

model_list

list of models, each of which contains marginal likelihood estimated with bridge sampling marglik and prior model odds prior_weights

samples

samples from a posterior distribution for a parameter generated by mix_posteriors or as_mixed_posteriors.

inference

object created by ensemble_inference function

parameter

parameter name to be plotted. Does not support PET-PEESE and weightfunction.

plot_type

whether to use a base plot "base" or ggplot2 "ggplot" for plotting.

prior

whether prior distribution should be added to the figure. When samples were prepared with as_mixed_posteriors(..., transform_scaled = TRUE), the transformed prior samples are automatically used.

conditional

whether conditional models should be displayed

order

list specifying ordering of the models. The first element describes whether the ordering should be "increasing" or "decreasing" and the second element describes whether the ordering should be based "model" order, "estimate" size, posterior "probability", or the inclusion "BF".

transformation

transformation to be applied to the prior distribution. Either a character specifying one of the prepared transformations:

lin

linear transformation in form of a + b*x

tanh

hyperbolic tangent transformation

exp

exponential transformation

, or a list containing the transformation function fun, inverse transformation function inv, and derivative of the transformation jac, evaluated on the original support. A custom transformation can also declare output_support = c(lower, upper). Display grids on the transformed scale are evaluated only within these bounds; a wider plotting range is retained without extending the density. Infinite inverse values at support boundaries are omitted from continuous density grids. Point masses retain their transformed locations.

transformation_arguments

a list with named arguments for the transformation

transformation_settings

boolean indicating whether the explicitly supplied x_seq or x_range is on the transformed scale. Automatically selected prior-coordinate ranges are always obtained on the source scale before the density family's existing transformation handling.

par_name

a type of parameter for which the prior is specified. Only relevant if the prior corresponds to a mu parameter that needs to be transformed.

formula_prefix

whether the formula_parameters names should be kept. Defaults to TRUE.

...

additional arguments. E.g.:

"show_updating"

whether Bayes factors and change from prior to posterior odds should be shown on the secondary y-axis

"show_estimates"

whether posterior estimates and 95% CI should be shown on the secondary y-axis

"y_axis2"

whether the secondary y-axis should be shown

Value

plot_models returns either NULL or an object of class 'ggplot' if plot_type is plot_type = "ggplot".

Details

Plots prior and posterior estimates of the same parameter across multiple models (prior distributions with orthonormal/meandif contrast are always plotted as differences from the grand mean). Ordered factors use the retained semantic level effects, omitting their zero-design reference rows, and per-model transformed level summaries. The model-averaged estimate uses the selected scalar level draws. With prior = FALSE, no prior means or intervals are computed or transformed; model probabilities and Bayes factors remain available for updating labels. With prior = TRUE, ordered level means use the total mean and exact allocation expectations with the persisted design. Their equal-tail 95\ intervals use structural prior probabilities and generalized quantiles, including exact jumps at point masses. No sampled prior means or quantiles are substituted. An undefined mean, unresolved expression, unsupported structural probability route, or unavailable numerical diagnostics raises BayesTools_prior_interval_unavailable (also BayesTools_plot_condition), identifying the model and level; set prior = FALSE to plot posterior estimates.