Plot Cumulative Distribution Function
Produce a cumulative distribution function (cdf) plot for a user-specified distribution.
cdfPlot(distribution = "norm", param.list = list(mean = 0, sd = 1), left.tail.cutoff = ifelse(is.finite(supp.min), 0, 0.001), right.tail.cutoff = ifelse(is.finite(supp.max), 0, 0.001), plot.it = TRUE, add = FALSE, n.points = 1000, cdf.col = "black", cdf.lwd = 3 * par("cex"), cdf.lty = 1, curve.fill = FALSE, curve.fill.col = "cyan", digits = .Options$digits, ..., type = ifelse(discrete, "s", "l"), main = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL)
distribution |
a character string denoting the distribution abbreviation. The default value is
|
param.list |
a list with values for the parameters of the distribution. The default value is
|
left.tail.cutoff |
a numeric scalar indicating what proportion of the left-tail of the probability
distribution to omit from the plot. For densities with a finite support minimum
(e.g., Lognormal) the default value is |
right.tail.cutoff |
a scalar indicating what proportion of the right-tail of the probability
distribution to omit from the plot. For densities with a finite support maximum
(e.g., Binomial) the default value is |
plot.it |
a logical scalar indicating whether to create a plot or add to the existing plot
(see |
add |
a logical scalar indicating whether to add the cumulative distribution function curve
to the existing plot ( |
n.points |
a numeric scalar specifying at how many evenly-spaced points the cumulative
distribution function will be evaluated. The default value is |
cdf.col |
a numeric scalar or character string determining
the color of the cdf line in the plot.
The default value is |
cdf.lwd |
a numeric scalar determining the width of the cdf
line in the plot.
The default value is |
cdf.lty |
a numeric scalar determining the line type of
the cdf line in the plot.
The default value is |
curve.fill |
a logical value indicating whether to fill in
the area below the cumulative distribution function curve with the color specified by
|
curve.fill.col |
when |
digits |
a scalar indicating how many significant digits to print for the distribution
parameters. The default value is |
type, main, xlab, ylab, xlim, ylim, ... |
additional graphical parameters (see |
The cumulative distribution function (cdf) of a random variable X, usually denoted F, is defined as:
F(x) = Pr(X ≤ x) \;\;\;\;\;\; (1)
That is, F(x) is the probability that X is less than or equal to x. This is the probability that the random variable X takes on a value in the interval (-∞, x] and is simply the (Lebesgue) integral of the pdf evaluated between -∞ and x. That is,
F(x) = Pr(X ≤ x) = \int_{-∞}^x f(t) dt \;\;\;\;\;\; (2)
where f(t) denotes the probability density function of X evaluated at t. For discrete distributions, Equation (2) translates to summing up the probabilities of all values in this interval:
F(x) = Pr(X ≤ x) = ∑_{t \in (-∞,x]} f(t) = ∑_{t \in (-∞,x]} Pr(X = t) \;\;\;\;\;\; (3)
A cumulative distribution function (cdf) plot plots the values of the cdf against quantiles of the specified distribution. Theoretical cdf plots are sometimes plotted along with empirical cdf plots to visually assess whether data have a particular distribution.
cdfPlot
invisibly returns a list giving coordinates of the points
that have been or would have been plotted:
Quantiles |
The quantiles used for the plot. |
Cumulative.Probabilities |
The values of the cdf associated with the quantiles. |
Steven P. Millard (EnvStats@ProbStatInfo.com)
Forbes, C., M. Evans, N. Hastings, and B. Peacock. (2011). Statistical Distributions. Fourth Edition. John Wiley and Sons, Hoboken, NJ.
Johnson, N. L., S. Kotz, and A.W. Kemp. (1992). Univariate Discrete Distributions, Second Edition. John Wiley and Sons, New York.
Johnson, N. L., S. Kotz, and N. Balakrishnan. (1994). Continuous Univariate Distributions, Volume 1. Second Edition. John Wiley and Sons, New York.
Johnson, N. L., S. Kotz, and N. Balakrishnan. (1995). Continuous Univariate Distributions, Volume 2. Second Edition. John Wiley and Sons, New York.
# Plot the cdf of the standard normal distribution #------------------------------------------------- dev.new() cdfPlot() #========== # Plot the cdf of the standard normal distribution # and a N(2, 2) distribution on the sample plot. #------------------------------------------------- dev.new() cdfPlot(param.list = list(mean=2, sd=2), main = "") cdfPlot(add = TRUE, cdf.col = "red") legend("topleft", legend = c("N(2,2)", "N(0,1)"), col = c("black", "red"), lwd = 3 * par("cex")) title("CDF Plots for Two Normal Distributions") #========== # Clean up #--------- graphics.off()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.