Description Usage Arguments Note References See Also Examples
pdMedian
calculates a weighted intrinsic median of a sample of (d,d)-dimensional
HPD matrices based on a Weiszfeld algorithm intrinsic to the chosen metric.In the case of the
affine-invariant Riemannian metric as detailed in e.g., \insertCiteB09pdSpecEst[Chapter 6] or
\insertCitePFA05pdSpecEst, the intrinsic Weiszfeld algorithm in \insertCiteF09pdSpecEst is used.
By default, the unweighted intrinsic median is computed.
1 | pdMedian(M, w, metric = "Riemannian", maxit = 1000, reltol)
|
M |
a (d,d,S)-dimensional array corresponding to a sample of (d,d)-dimensional HPD matrices of size S. |
w |
an S-dimensional nonnegative weight vector, such that |
metric |
the distance measure, one of |
maxit |
maximum number of iterations in gradient descent algorithm. Defaults to |
reltol |
optional tolerance parameter in gradient descent algorithm. Defaults to |
The function does not check for positive definiteness of the input matrices, and (depending on the specified metric) may fail if matrices are close to being singular.
1 2 3 4 5 6 7 8 9 10 11 | ## Generate random sample of HPD matrices
m <- function(){
X <- matrix(complex(real=rnorm(9), imaginary=rnorm(9)), nrow=3)
t(Conj(X)) %*% X
}
M <- replicate(100, m())
## Generate random weight vector
z <- rnorm(100)
w <- abs(z)/sum(abs(z))
## Compute weighted intrinsic (Riemannian) median
pdMedian(M, w)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.