Plot samples from the mixed posterior distributions
plot_posterior(
samples,
parameter,
plot_type = "base",
prior = FALSE,
n_points = 1000,
n_samples = 10000,
force_samples = FALSE,
individual = FALSE,
show_figures = NULL,
transformation = NULL,
transformation_arguments = NULL,
transformation_settings = FALSE,
rescale_x = FALSE,
par_name = NULL,
effect_direction = "positive",
dots_prior = list(),
data = NULL,
show_data = FALSE,
dots_data = list(),
legend = TRUE,
legend_title = NULL,
legend_labels = NULL,
legend_position = NULL,
...
)plot_posterior returns either NULL or
an object of class 'ggplot' if plot_type is plot_type = "ggplot".
samples from a posterior distribution for a parameter generated by mix_posteriors or as_mixed_posteriors.
parameter name to be plotted. Use "PETPEESE"
for PET-PEESE plot with parameters "PET" and "PEESE",
and "weightfunction" for plotting a weightfunction with
parameters "omega".
whether to use a base plot "base"
or ggplot2 "ggplot" for plotting.
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.
number of equally spaced points
in the x_range if x_seq is unspecified
number of samples from the prior
distribution if the density cannot be obtained
analytically (or if samples are forced with
force_samples = TRUE)
should prior be sampled instead of obtaining analytic solution whenever possible
should individual densities be returned (e.g., in case of weightfunction)
which figures should be returned in case of
multiple plots are generated. Useful when priors for the omega
parameter are plotted and individual = TRUE.
transformation to be applied to the prior distribution. Either a character specifying one of the prepared transformations:
linear transformation in form of a + b*x
hyperbolic tangent transformation
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. See examples
for details.
a list with named arguments for
the transformation
boolean indicating whether the
settings the x_seq or x_range was specified on
the transformed support
allows to rescale x-axis in case a weightfunction is plotted.
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.
direction of the effect for PET-PEESE
regression. Use "positive" (default) for
mu + PET*se + PEESE*se^2 or "negative" for
mu - PET*se - PEESE*se^2.
additional arguments for the prior distribution plot
optional numeric vector of observed p-values in [0, 1], or
a data frame with a p column. Used only for weightfunction plots.
whether observed p-values should be shown as rug marks on the weightfunction x-axis.
additional styling arguments for observed p-value rug marks.
Supports col/color, alpha, lwd/linewidth,
side/rug_side, and height/rug_height.
whether factor legends should be drawn.
optional title for factor legends.
optional labels for factor legend levels.
optional legend position for factor legends.
additional arguments
When using scaled predictors (via formula_scale_list in JAGS_fit),
you can plot posteriors on the original (unscaled) scale by preparing samples with
as_mixed_posteriors(..., transform_scaled = TRUE). The function automatically
detects this and uses the pre-computed transformed prior samples when prior = TRUE.
prior() lines_prior_list() geom_prior_list()