Learn R Programming

RiemBase (version 0.1.0)

rmean: Robust Fr<U+00E9>chet Mean of Manifold-valued Data

Description

Robust estimator for mean starts from dividing the data \(\{x_i\}_{i=1}^n\) into \(k\) equally sized sets. For each subset, it first estimates Fr<U+00E9>chet mean. It then follows a step to aggregate \(k\) sample means by finding a geometric median.

Usage

rmean(input, k = 5, maxiter = 496, eps = 1e-06, parallel = FALSE)

Arguments

input

a S3 object of riemdata class. See riemfactory for more details.

k

number of subsets for which the data be divided into.

maxiter

maximum number of iterations for gradient descent algorithm and Weiszfeld algorithm.

eps

stopping criterion for the norm of gradient.

parallel

a flag for enabling parallel computation.

Value

a named list containing

x

an estimate geometric median.

iteration

number of iterations until convergence.

References

2011arXiv1112.3914LRiemBase

2013arXiv1308.1334MRiemBase

2014arXiv1409.5937FRiemBase

See Also

mean, median

Examples

Run this code
# NOT RUN {
### Generate 100 data points on Sphere S^2 near (0,0,1).
ndata = 100
theta = seq(from=-0.99,to=0.99,length.out=ndata)*pi
tmpx  = cos(theta) + rnorm(ndata,sd=0.1)
tmpy  = sin(theta) + rnorm(ndata,sd=0.1)

### Wrap it as 'riemdata' class
data  = list()
for (i in 1:ndata){
  tgt = c(tmpx[i],tmpy[i],1)
  data[[i]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
data = riemfactory(data, name="sphere")

### Compute Robust Fr<U+00E9>chet Mean
out1 = RiemBase::rmean(data)
out2 = RiemBase::rmean(data,parallel=TRUE) # test parallel implementation
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab