Learn R Programming

RiemBaseExt (version 0.1.2)

rstat.frechet: Fr<U+00E9>chet Mean and Variation of Manifold-valued Data

Description

For manifold-valued data, Fr<U+00E9>chet mean is the solution of following cost function, $$\textrm{min}_x \sum_{i=1}^n \rho^2 (x, x_i),\quad x\in\mathcal{M}$$ for a given data \(\{x_i\}_{i=1}^n\) and \(\rho(x,y)\) is the geodesic distance between two points on manifold \(\mathcal{M}\). It uses a gradient descent method with a backtracking search rule for updating.

Usage

rstat.frechet(
  input,
  type = c("intrinsic", "extrinsic"),
  int.eps = 1e-06,
  parallel = FALSE
)

Arguments

input

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

type

type of distance, either "intrinsic" or "extrinsic".

int.eps

stopping criterion for the norm of gradient.

parallel

a flag for enabling parallel computation.

Value

a named list containing

mu

an estimated Fr<U+00E9>chet mean matrix.

variation

Fr<U+00E9>chet variation with the estimated mean.

References

karcher_riemannian_1977RiemBaseExt

kendall_probability_1990RiemBaseExt

afsari_convergence_2013RiemBaseExt

Examples

Run this code
# NOT RUN {
### Generate 50 data points on Sphere S^2 near (0,0,1).
ndata = 50
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 = RiemBase::riemfactory(data, name="sphere")

### Compute Fr<U+00E9>chet Mean and Variation
out1 = rstat.frechet(data)                   # intrinsic
out2 = rstat.frechet(data,parallel=TRUE)     # parallel implementation
out3 = rstat.frechet(data, type="extrinsic") # extrinsic

# }

Run the code above in your browser using DataLab