Description Usage Arguments Value References Examples
View source: R/rstat.frechet.R
For manifold-valued data, Fréchet mean is the solution of following cost function,
\textrm{min}_x ∑_{i=1}^n ρ^2 (x, x_i),\quad x\in\mathcal{M}
for a given data \{x_i\}_{i=1}^n and ρ(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.
1 2 3 4 5 6 | rstat.frechet(
input,
type = c("intrinsic", "extrinsic"),
int.eps = 1e-06,
parallel = FALSE
)
|
input |
a S3 object of |
type |
type of distance, either |
int.eps |
stopping criterion for the norm of gradient. |
parallel |
a flag for enabling parallel computation. |
a named list containing
an estimated Fréchet mean matrix.
Fréchet variation with the estimated mean.
karcher_riemannian_1977RiemBaseExt
\insertRefkendall_probability_1990RiemBaseExt
\insertRefafsari_convergence_2013RiemBaseExt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ### 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échet Mean and Variation
out1 = rstat.frechet(data) # intrinsic
out2 = rstat.frechet(data,parallel=TRUE) # parallel implementation
out3 = rstat.frechet(data, type="extrinsic") # extrinsic
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.