Learn R Programming

distr6 (version 1.6.9)

plot.Matdist: Plotting Distribution Functions for a Matrix Distribution

Description

Helper function to more easily plot a Matdist.

Usage

# S3 method for Matdist
plot(x, fun = c("pdf", "cdf", "survival", "hazard", "cumhazard"), ...)

Arguments

fun

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

...

Other parameters passed to matplot.

Details

Essentially just a wrapper around matplot.

See Also

plot.Distribution plot.VectorDistribution

Examples

Run this code
# NOT RUN {
pdf <- runif(200)
mat <- matrix(pdf, 20, 10)
mat <- t(apply(mat, 1, function(x) x / sum(x)))
colnames(mat) <- 1:10
d <- as.Distribution(mat, fun = "pdf")
plot(d, "pdf", xlab = "x", ylab = "p(x)")
plot(d, "cdf", xlab = "x", ylab = "F(x)")
plot(d, "survival", xlab = "x", ylab = "S(x)")
plot(d, "hazard", xlab = "x", ylab = "h(x)")
plot(d, "cumhazard", xlab = "x", ylab = "H(x)")
# }

Run the code above in your browser using DataLab