Learn R Programming

phonR (version 0.4-2)

ellipse: Draw Two-Dimensional Ellipse Based on Mean and Covariance

Description

Draw a two-dimensional ellipse that traces a bivariate normal density contour for a given mean vector, covariance matrix, and probability content. Note: this function was absorbed into phonR from the now-defunct package mixtools by Derek Young, Tatiana Benaglia, Didier Chauveau, Ryan Elmore, Tom Hettmansperger, David Hunter, Hoben Thomas, and Fengjuan Xuan.

Usage

ellipse(mu, sigma, alpha = .05, npoints = 250, newplot = FALSE,
        draw = TRUE, ...)

Arguments

Value

ellipse returns an npointsx2 matrix of the points forming the border of the ellipse.

References

Johnson, R. A. and Wichern, D. W. (2002) Applied Multivariate Statistical Analysis, Fifth Edition, Prentice Hall.

Examples

Run this code
## Produce a 95\% ellipse with the specified mean and covariance structure. 

mu <- c(1, 3)
sigma <- matrix(c(1, .3, .3, 1.5), 2, 2)

ellipse(mu, sigma, npoints = 200, newplot = TRUE)

Run the code above in your browser using DataLab