Learn R Programming

SIBER (version 2.1.9)

pointsToEllipsoid: Test whether a set of points are inside or outside a defined ellipse

Description

Takes a i x d matrix of points where d is the dimension of the space considered, and i is the number of points and returns TRUE or FALSE for whether each point is inside or outside a d-dimensional ellipsoid defined by a covariance matrix Sigma and vector of means mu.

Usage

pointsToEllipsoid(X, Sigma, mu)

Value

A matrix of transformed data points corresponding to X

Arguments

X

the i x d matrix of data points to be transformed

Sigma

the d x d covariance matrix of the ellipsoid

mu

the vector of means of the ellipse of length d

Examples

Run this code
X <- matrix(runif(200,-2.5, 2.5), ncol = 2, nrow = 100)
SIG <- matrix(c(1,0,0,1), ncol = 2, nrow = 2)
mu <- c(0, 0)
Z <- pointsToEllipsoid(X, SIG, mu)
test <- ellipseInOut(Z, p = 0.95)
plot(X, col = test + 1, xlim = c(-3, 3), ylim = c(-3, 3), asp = 1)
addEllipse(mu, SIG, p.interval = 0.95)

Run the code above in your browser using DataLab