GmedianCov | R Documentation |
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.
GmedianCov(X, init=NULL, nn=TRUE, scores=2, gamma=2, gc=2, alpha=0.75, nstart=1)
X |
Data matrix, with n observations (rows) in dimension d (columns). |
init |
When |
nn |
When |
scores |
An integer |
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. |
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
.
median |
Vector of the geometric median |
covmedian |
Median covariation matrix |
vectors |
The |
scores |
Principal component scores corresponding to the |
sdev |
The |
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 Gmedian
and WeiszfeldCov
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.