Learn R Programming

geostats (version 1.6)

ellipse: ellipse

Description

Compute the x-y coordinates of an error ellipse.

Usage

ellipse(mean, cov, alpha = 0.05, n = 50)

Value

a two-column matrix of plot coordinates

Arguments

mean

two-element vector with the centre of the ellipse

cov

the 2 x 2 covariance matrix of x and y

alpha

confidence level of the ellipse

n

the number of points at which the ellipse is evaluated

Examples

Run this code
X <- rnorm(100,mean=100,sd=1)
Y <- rnorm(100,mean=100,sd=1)
Z <- rnorm(100,mean=100,sd=5)
dat <- cbind(X/Z,Y/Z)
plot(dat)
ell <- ellipse(mean=colMeans(dat),cov=cov(dat))
polygon(ell)

Run the code above in your browser using DataLab