plot_prior | R Documentation |
Plots density curves for specified distributions to help visualise their shape and domain.
plot_prior(p_prior, font_size = 5, cex = 5, return_data = FALSE)
p_prior |
A list of distribution specifications. Each element should be a list containing:
|
font_size |
Numeric. Base font size for plot labels. Defaults to 5. |
cex |
Numeric. Scaling factor for plot elements. Defaults to 5. |
return_data |
Logical. If |
This function:
Automatically determines appropriate x-axis ranges based on each distribution's properties.
Handles both truncated and unbounded distributions.
Supports all distribution types implemented in the package.
For truncated distributions, the density is plotted only within the specified bounds.
A heuristic is used to generate axis limits and labels using the internal
generate_x_value
function.
If return_data = FALSE
(default), a lattice plot object is returned
displaying the density curves for each prior. If return_data = TRUE
, a data
frame is returned with the following columns:
x
: Numeric vector of x-values generated for each prior using a heuristic.
y
: Corresponding density (or log-density) values.
gp
: Group label or parameter name for each distribution.
# Define a joint distribution
p_prior <- BuildPrior(
p0 = c(A = 0.15, B = 0.45, mean_v = 2.25, sd_v = 0.15, t0 = 0.2),
p1 = rep(0.1, 5),
lower = rep(NA, 5),
upper = rep(NA, 5),
dist = rep("tnorm", 5),
log_p = rep(FALSE, 5)
)
plot_prior(p_prior)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.