GmedianCov: GmedianCov

View source: R/GmedianCov.R

GmedianCovR Documentation

GmedianCov

Description

Computes recursively the Geometric median and the (geometric) median covariation matrix with fast averaged stochastic gradient algorithms. The estimation of the Geometric median is performed first and then the median covariation matrix is estimated, as well as its leading eigenvectors. The original recursive estimator of the median covariation matrix may not be a non negative matrix. A fast projected estimator onto the convex closed cone of the non negative matrices allows to get a non negative solution.

Usage

GmedianCov(X, init=NULL, nn=TRUE, scores=2, gamma=2, gc=2, alpha=0.75, nstart=1)

Arguments

X

Data matrix, with n observations (rows) in dimension d (columns).

init

When NULL the starting point of the algorithm estimating the median is the first observation.

nn

When TRUE the algorithm provides a non negative estimates of the median covariation matrix. When nn=FALSE, the original algorithm is performed, with no guaranty that all the eigenvalues of the estimates are non negative

scores

An integer q, by default q=2. The function computes the eigenvectors of the median covariation matrix associated to the q largest eigenvalues and the corresponding principal component scores. No output if scores=0.

gamma

Value (positive) of the constant controling the descent steps (see details) for the algorithm computing median.

gc

Value (positive) of the constant controling the descent steps (see details) for algorithm computing the median covariation matrix

alpha

Rate of decrease of the descent steps, 1/2 < alpha <=1.

nstart

Number of time the algorithms are ran.

Details

The (fast) computation of the eigenvectors is performed by eigs_sym of package RSpectra. See Cardot, H. and Godichon-Baggioni (2017) for more details on the recursive algorithm. See also Gmedian. When nn=TRUE, the descent step is bounded above so that the solution remains non negative at each iteration. The principal components standard deviation is estimed robustly thanks to function scaleTau2 from package robustbase.

Value

median

Vector of the geometric median

covmedian

Median covariation matrix

vectors

The scores=q eigenvectors of the median covariation matrix associated to the q largest eigenvalues

scores

Principal component scores corresponding to the scores=q eigenvectors

sdev

The scores=q estimates of the standard deviation of the scores=q principal components.

References

Cardot, H., Cenac, P. and Zitt, P-A. (2013). Efficient and fast estimation of the geometric median in Hilbert spaces with an averaged stochastic gradient algorithm. Bernoulli, 19, 18-43.

Cardot, H. and Godichon-Baggioni, A. (2017). Fast Estimation of the Median Covariation Matrix with Application to Online Robust Principal Components Analysis. TEST, 26, 461-480.

See Also

See also Gmedian and WeiszfeldCov.

Examples

## Simulated data - Brownian paths
n <- 1e3
d <- 20
x <- matrix(rnorm(n*d,sd=1/sqrt(d)), n, d)
x <- t(apply(x,1,cumsum))

## Estimation
median.est <- GmedianCov(x)

par(mfrow=c(1,2))
image(median.est$covmedian) ## median covariation function
plot(c(1:d)/d,median.est$vectors[,1]*sqrt(d),type="l",xlab="Time",
ylab="Eigenvectors",ylim=c(-1.4,1.4))
lines(c(1:d)/d,median.est$vectors[,2]*sqrt(d),lty=2)

Gmedian documentation built on June 8, 2022, 5:07 p.m.