# 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

1 | ```
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. |

### 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π*. 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 *θ* and the second column *φ*. The type of coordinates is determined automatically based on the dimensions of the input.

### Value

Returns the spherical depth of multivariate point `theta`

with respect to the data set `P`

.

### Author(s)

Maxime Genest.

### 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

1 2 3 4 5 6 7 8 9 10 11 | ```
## 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)
``` |