Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ellipse

Point coordinates for a 2-D ellipse.


Description

Calculates coordinates of points for plotting a 2-dimensional ellipse based on user-defined parameters. Can be used for exploratory data analysis to produce ellipses at a given niche region size (e.g., α = 95\%).

Usage

ellipse(mu, V, alpha = 0.95, n = 100)

Arguments

mu

centre of ellipse. A vector of length 2.

V

scale of ellipse. A 2x2 matrix. See Details.

alpha

niche region size. See Details.

n

number of points to return for plotting.

Details

This function provides the coordinates needed to plot a 2-dimensional ellipse based on user-defined parameters, such that X = c(x,y) satisfies the equation

(X-μ)' V^{-1} (X-μ) = C,

where C=\code{qchisq(alpha, df = 2)}.

Value

Returns a matrix of coordinates cbind(x,y) to plot a 2-dimensional ellipse.

See Also

Examples

mu <- rnorm(2)
V <- crossprod(matrix(rnorm(4), 2, 2))
ell.pts <- ellipse(mu = mu, V = V, alpha = .9, n = 100)
plot(ell.pts, col = rainbow(110)[1:100], type = "o")
points(mu[1], mu[2], pch = "+")

nicheROVER

(Niche) (R)egion and Niche (Over)lap Metrics for Multidimensional Ecological Niches

v1.0
GPL-2
Authors
Martin Lysy [aut, cre], Ashley D. Stasko [aut, ctb], Heidi K. Swanson [aut, ctb]
Initial release
2014-07-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.