Learn R Programming

nicheROVER (version 1.1.2)

niche.runif: Uniform sampling from an elliptical niche region.

Description

Uniform sampling from an elliptical niche region.

Usage

niche.runif(n, mu, Sigma, alpha = 0.95)

Value

IID draws from a uniform distribution on the elliptical niche region.

Arguments

n

Number of random draws.

mu

Mean vector.

Sigma

Variance matrix.

alpha

Probabilistic niche size

See Also

ellipse() and niche.size() for the definition of the elliptical niche region.

Examples

Run this code
# 2d example
d <- 2 # number of dimensions
V <- crossprod(matrix(rnorm(4),d,d))
mu <- rnorm(d)
plot(ellipse(mu, V), type = "l")
points(niche.runif(1e4, mu, V), col = "brown", pch = ".")

Run the code above in your browser using DataLab