Learn R Programming

fdasrvf (version 2.3.6)

multivariate_karcher_mean: Karcher Mean of Multivariate Functional Data

Description

Calculates the Karcher mean or median of a collection of multivariate functional data using the elastic square-root velocity (SRVF) framework. While most of the time, the setting does not require a metric that is invariant to rotation and scale, this can be achieved through the optional arguments rotation and scale.

Usage

multivariate_karcher_mean(
  beta,
  mode = "O",
  alignment = TRUE,
  rotation = FALSE,
  scale = FALSE,
  lambda = 0,
  maxit = 20L,
  ms = c("mean", "median"),
  exact_medoid = FALSE,
  ncores = 1L,
  verbose = FALSE
)

Value

A list with the following components:

  • beta: A numeric array of shape \(L \times M \times N\) storing the original input data.

  • q: A numeric array of shape \(L \times M \times N\) storing the SRVFs of the input data.

  • betan: A numeric array of shape \(L \times M \times N\) storing the aligned, possibly optimally rotated and optimally scaled, input data.

  • qn: A numeric array of shape \(L \times M \times N\) storing the SRVFs of the aligned, possibly optimally rotated and optimally scaled, input data.

  • gamma: A numeric array of shape \(L \times M \times N\) storing the warping functions of the aligned, possibly optimally rotated and optimally scaled, input data.

  • betamean: A numeric array of shape \(L \times M\) storing the Karcher mean or median of the input data.

  • qmean: A numeric array of shape \(L \times M\) storing the Karcher mean or median of the SRVFs of the input data.

  • type: A character string indicating whether the Karcher mean or median has been returned.

  • E: A numeric vector storing the energy of the Karcher mean or median at each iteration.

  • qun: A numeric vector storing the cost function of the Karcher mean or median at each iteration.

Arguments

beta

A numeric array of shape \(L \times M \times N\) specifying an \(N\)-sample of \(L\)-dimensional functional data evaluated on a same grid of size \(M\).

mode

A character string specifying whether the input curves should be considered open (mode == "O") or closed (mode == "C"). Defaults to "O".

alignment

A boolean value specifying whether the curves should be aligned before computing the distance matrix. Defaults to TRUE.

rotation

A boolean specifying whether the distance should be made invariant by rotation. Defaults to TRUE.

scale

A boolean specifying whether the distance should be made invariant by scaling. This is effectively achieved by making SRVFs having unit length and switching to an appropriate metric on the sphere between normalized SRVFs. Defaults to TRUE.

lambda

A numeric value specifying the weight of a penalty term that constraints the warping function to be not too far from the identity. Defaults to 0.0.

maxit

An integer value specifying the maximum number of iterations. Defaults to 20L.

ms

A character string specifying whether the Karcher mean ("mean") or Karcher median ("median") is returned. Defaults to "mean".

exact_medoid

A boolean specifying whether to compute the exact medoid from the distance matrix or as the input curve closest to the pointwise mean. Defaults to FALSE for saving computational time.

ncores

An integer value specifying the number of cores to use for parallel computation. Defaults to 1L. The maximum number of available cores is determined by the parallel package. One core is always left out to avoid overloading the system.

verbose

A boolean specifying whether to print the progress of the algorithm. Defaults to FALSE.

References

Srivastava, A., Klassen, E., Joshi, S., Jermyn, I., (2011). Shape analysis of elastic curves in euclidean spaces. IEEE Transactions on Pattern Analysis and Machine Intelligence, 33 (7), 1415-1428.

Examples

Run this code
out <- multivariate_karcher_mean(beta[, , 1, 1:2], maxit = 2)
# note: use more functions, small for speed

Run the code above in your browser using DataLab