cdfPlot: Plot Cumulative Distribution Function In EnvStats: Package for Environmental Statistics, Including US EPA Guidance

Description

Produce a cumulative distribution function (cdf) plot for a user-specified distribution.

Details

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.

Value

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.

Author(s)

Steven P. Millard ([email protected])

References

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.

Distribution.df, ecdfPlot, cdfCompare, pdfPlot.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  # 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()