Learn R Programming

mrfDepth (version 1.0.17)

rdepthmedian: Hyperplane of maximal regression depth

Description

Computes the deepest regression, i.e. the hyperplane with maximal regression depth given a regression dataset with \(p\) explanatory variables. The computation is exact for simple regression, and approximate otherwise.

Usage

rdepthmedian(x, maxit = NULL)

Value

A list with components:

deepest

A \((p+1)\) vector containing the estimates of the deepest regression fit. The last \(p\) values are the slopes, the first value corresponds to the intercept.

depth

The depth of the deepest regression hyperplane.

niter

The number of performed iterations used in the medsweep algorithm.

dimension

When the data x are lying in a lower dimensional subspace, the dimension of this subspace.

hyperplane

When the data x are lying in a lower dimensional subspace, a direction orthogonal to this subspace.

Arguments

x

An \(n\) by \(p+1\) regression data matrix.
The first \(p\) columns are the explanatory variables. The last column corresponds to the response variable.

maxit

The maximum number of iterations.
Defaults to \(100\).

Author

P. Segaert using Fortran code by S. Van Aelst

Details

In simple regression the deepest regression fit can be computed exactly by considering all lines through two data points and taking the one with maximal regression depth. If several lines have the same maximal regression depth, their average is taken.

When \(p > 1\), the approximate MEDSWEEP algorithm is applied (Van Aelst et al, 2002).

It is first checked whether the data lie in a subspace of dimension smaller than \(p + 1\). If so, a warning is given, as well as the dimension of the subspace and a direction which is orthogonal to it.

References

Van Aelst S., Rousseeuw P.J., Hubert M., Struyf A. (2002). The deepest regression method. Journal of Multivariate Analysis, 81, 138--166.

See Also

rdepth, cmltest

Examples

Run this code
# Illustrate the concept of deepest regression line in the case of simple 
# linear regression. 
data(stars)
plot(stars, pch=16)
result <- rdepthmedian(x = stars)
abline(result$deepest, col="blue", lwd=2)

x <- matrix(rnorm(3000), ncol = 3) + 10
rdepthmedian(x = x)

Run the code above in your browser using DataLab