Learn R Programming

depth (version 2.1-1.1)

sdepth: Calculation of spherical depth

Description

Computes the spherical depth of a point with respect to a multivariate data set. Supports data on the circle or on the sphere.

Usage

sdepth(theta, P)

Arguments

theta

Numerical vector whose depth is to be calculated. The coordinate system must match that of the observations.

P

The data as a vector, a matrix, a data frame or a list.

Value

Returns the spherical depth of multivariate point theta with respect to the data set P.

Details

Computes the Tukey depth of theta with respect to the dataset P. For data on the circle, data must be expressed in polar coordinates as a angle in radians with values between 0 and \(2\pi\). Data on the sphere can be expressed in Euclidean coordinates (\(n\) by 3 matrix) or in spherical coordinates (\(n\) by 2 matrix) where the first column contains \(\theta\) and the second column \(\phi\). The type of coordinates is determined automatically based on the dimensions of the input.

References

Liu, R.Y., Parelius, J.M. and Singh, K. (1999), Multivariate analysis by data depth: Descriptive statistics, graphics and inference (with discussion), Ann. Statist., 27, 783--858.

Mardia, K.V. and Jupp, E.J. (1999). Directional Statistics, Wiley.

See Also

scontour for depth graphics, smed for Tukey's spherical median.

Examples

Run this code
# NOT RUN {
## Tukey spherical depth for a dataset on the circle
set.seed(2011)
sdepth(pi,runif(50,min=0,max=2*pi))

## Tukey spherical depth for data in spherical coordinates.
sdepth(c(pi,pi/2),cbind(runif(50,min=0,max=2*pi),runif(50,min=0,max=pi)))

## Tukey spherical depth for data in Eudlidean coordinates.
x=matrix(rnorm(150),ncol=3)
x=t(apply(x,1,function(y){y/sqrt(sum(y^2))}))
sdepth(x[1,],x)
# }

Run the code above in your browser using DataLab