Helper function to more easily plot distributions inside a VectorDistribution.

# S3 method for VectorDistribution
plot(x, fun = "pdf", topn, ind, cols, ...)

Arguments

x

VectorDistribution.

fun

function to plot, one of: "pdf","cdf","quantile", "survival", "hazard", "cumhazard".

topn

integer. First n distributions in the VectorDistribution to plot.

ind

integer. Indices of the distributions in the VectorDistribution to plot. If given then topn is ignored.

cols

character. Vector of colours for plotting the curves. If missing 1:9 are used.

...

Other parameters passed to plot.Distribution.

Details

If topn and ind are both missing then all distributions are plotted if there are 10 or less in the vector, otherwise the function will error.

Examples

if (FALSE) {
# Plot pdf of Normal distribution
vd <- VectorDistribution$new(list(Normal$new(), Normal$new(mean = 2)))
plot(vd)
plot(vd, fun = "surv")
plot(vd, fun = "quantile", ylim = c(-4, 4), col = c("blue", "purple"))
}