Visualizes posterior trends from a birp object by plotting the median and quantile intervals of the estimated relative densities over time. Optionally, vertical lines can be added to mark epoch boundaries and survey timepoints.
plot_trend(
x,
CI_group = 1,
n_points = 1000,
quantiles = c(0.99, 0.9, 0.5, 0.25),
quantile.col = gray(seq(1, 0, length.out = length(quantiles) + 2)[2:(length(quantiles)
+ 1)]),
quantile.border = NA,
median.col = "deeppink",
median.lwd = 1,
median.lty = 1,
epoch.col = "black",
epoch.lwd = 1,
epoch.lty = 1,
times.col = "black",
times.lwd = 1,
times.lty = 2,
log = FALSE,
xlab = "Time",
ylab = paste(c("log", "Relative Density")[c(log, TRUE)], collapse = " "),
main = x$CI_groups[CI_group],
...
)No return value, called for side effects.
A birp object containing MCMC trace and model outputs.
Integer; Index of the control-intervention group to plot. Default is 1.
Integer; Number of points to evaluate the trend over time. Default is 1000.
Numeric vector; Quantiles to plot as shaded intervals. Must be in (0, 1). Default is c(0.99, 0.9, 0.5, 0.25).
Character vector or color values; Fill colors for quantile polygons. Default is shades of gray.
Character or NA; Border color for quantile polygons. Use NA to omit borders. Default is NA.
Character; Color of the median trend line. Default is "deeppink".
Numeric; Line width for the median trend. Default is 1.
Numeric or character; Line type for the median trend line. Default is 1 (solid).
Character or color specification; Color for lines representing epoch boundaries. Default is "black".
Numeric; Line width for epoch boundary lines. Default is 1.
Numeric or character; Line type for epoch boundary lines. Default is 1 (solid).
Character or color specification; Color for vertical lines representing measurement times. Default is "black".
Numeric; Line width for measurement time lines. Default is 1.
Numeric or character scalar; Line type for measurement time lines. Default is 2 (dashed).
Logical; If TRUE, plot relative densities on a logarithmic scale; otherwise plot on the original scale. Default is FALSE.
Character; Label for the x-axis. Default is "Time".
Character; Label for the y-axis. Default dynamically set to either "log Relative Density" or "Relative Density".
Character; Main title of the plot. Defaults to the name of the selected CI group.
Additional graphical parameters passed to the base plot function.
birp
data <- simulate_birp()
est <- birp(data)
plot_trend(est)
Run the code above in your browser using DataLab