# pdfPlot: Plot Probability Density Function

Description Usage Arguments Details Value Author(s) References See Also Examples

### Description

Produce a probability density function (pdf) plot for a user-specified distribution.

### Details

The probability density function (pdf) of a random variable X, usually denoted f, is defined as:

f(x) = \frac{dF(x)}{dx} \;\;\;\;\;\; (1)

where F is the cumulative distribution function (cdf) of X. That is, f(x) is the derivative of the cdf F with respect to x (where this derivative exists).

For discrete distributions, the probability density function is simply:

f(x) = Pr(X = x) \;\;\;\;\;\; (2)

In this case, f is sometimes called the probability function or probability mass function.

The probability that the random variable X takes on a value in the interval [a, b] is simply the (Lebesgue) integral of the pdf evaluated between a and b. That is,

Pr(a ≤ X ≤ b) = \int_a^b f(x) dx \;\;\;\;\;\; (3)

For discrete distributions, Equation (3) translates to summing up the probabilities of all values in this interval:

Pr(a ≤ X ≤ b) = ∑_{x \in [a,b]} f(x) = ∑_{x \in [a,b]} Pr(X = x) \;\;\;\;\;\; (4)

A probability density function (pdf) plot plots the values of the pdf against quantiles of the specified distribution. Theoretical pdf plots are sometimes plotted along with empirical pdf plots (density plots), histograms or bar graphs to visually assess whether data have a particular distribution.

### Value

pdfPlot invisibly returns a list giving coordinates of the points that have been or would have been plotted:

 Quantiles The quantiles used for the plot. Probability.Densities The values of the pdf associated with the quantiles.

### Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

### 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, epdfPlot, cdfPlot.

### Examples

  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 26  # Plot the pdf of the standard normal distribution #------------------------------------------------- dev.new() pdfPlot() #========== # Plot the pdf of the standard normal distribution # and a N(2, 2) distribution on the sample plot. #------------------------------------------------- dev.new() pdfPlot(param.list = list(mean=2, sd=2), curve.fill = FALSE, ylim = c(0, dnorm(0)), main = "") pdfPlot(add = TRUE, pdf.col = "red") legend("topright", legend = c("N(2,2)", "N(0,1)"), col = c("black", "red"), lwd = 3 * par("cex")) title("PDF Plots for Two Normal Distributions") #========== # Clean up #--------- graphics.off() 

Search within the EnvStats package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.