Learn R Programming

localdepth (version 0.5-7)

quantile.localdepth: Quantiles of the distribution of the size of simplices or ellipsoids

Description

The function evaluates the size of the objects formed from a dataset according to a statistic and returns the corresponding quantiles. Depending on the method the objects are simplices or ellipsoids.

Usage

"quantile"(x, probs, use = c("volume", "diameter"), method = c("simplicial", "ellipsoid", "halfspace", "mahalanobis", "hyperspheresimplicial"), nsamp = "all", size = FALSE, dimension = NULL, covariance=NULL, ...)

Arguments

x
numeric; vector, dataframe or matrix. If x is a circular vector, a circular version is used
probs
numeric; vector of probabilities with values in [0,1]. Quantile orders of the statistic
use
character; the statistic used to measure the size of the objects. For method equal to "simplicial" or "ellipsoid" allowed statistics are "volume" and "diameter". For method equal to "mahalanobis" this parameter is not used and the only available statistic is pairwise Mahalanobis' distance
method
character; the type of (local) depth to be evaluated
nsamp
character or numeric; the number of objects that are considered. If "all", the size of all choose(NROW(x), NCOL(x)+1) objects is evaluated. Otherwise, a simple random sample with replacement of size nsamp is performed from the set of all possible objects. See details below
size
logical; if TRUE the size of all possible objects is returned
dimension
numeric; only used with method="ellipsoid". It is the squared length of the ellipsoid semimajor axis. If dimension is NULL, it is set to NCOL(x)
covariance
NULL or a numeric matrix; the NCOL(x)*NCOL(x) covariance matrix used in method equal to "mahalanobis". If NULL, cov(x) is used
...
arguments passed to quantile.default

Value

If size is FALSE then a vector with the quantiles is returned, otherwise a list with the following components:
quantile
the requested quantiles
stats
the size of all objects
call
match.call()

Details

When choosing between nsamp='all' or a numeric value for nsamp the value of choose(NROW(x), NCOL(x)+1) must be considered to avoid very long computing times. When the number of possible objects is greater than the maximum vector length manageable by the machine, an error is returned by the system. In this case it is necessary to use the approximated procedure through the parameter nsamp.

See Also

localdepth

Examples

Run this code

set.seed(1234)
x <- matrix(rnorm(60, 0, 1), ncol=2)
volumesimplex <- quantile.localdepth(x, probs=c(0.1, 0.2), size=TRUE)
volumesimplex$quantile
diametersimplex <- quantile.localdepth(x, probs=c(0.1, 0.2), size=TRUE, use='diameter')
diametersimplex$quantile
par(mfrow=c(2,2))
plot(ecdf(volumesimplex$stats), xlab='volume', main="ECDF of the simplices's volume")
boxplot(volumesimplex$stats, xlab='volume', main="Boxplot of the simplices's volume")
plot(ecdf(diametersimplex$stats), xlab='volume', main="ECDF of the simplices's diameter")
boxplot(diametersimplex$stats, xlab='volume', main="Boxplot of the simplices's diameter")

Run the code above in your browser using DataLab