curve_dist: Distance Matrix Computation

View source: R/curve_dist.R

curve_distR Documentation

Distance Matrix Computation

Description

Computes the pairwise distance matrix between a set of curves using the elastic shape distance as computed by calc_shape_dist().

Usage

curve_dist(
  beta,
  mode = "O",
  alignment = TRUE,
  rotation = FALSE,
  scale = FALSE,
  include.length = FALSE,
  lambda = 0,
  ncores = 1L
)

Arguments

beta

A numeric array of shape L \times M \times N specifying the set of N curves of length M in L-dimensional space.

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.

include.length

A boolean specifying whether to include information about the actual length of the SRVFs in the metric when using normalized SRVFs to achieve scale invariance. This only applies if scale == TRUE. Defaults to FALSE.

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.

ncores

An integer value specifying the number of cores to use for parallel computation. If ncores is greater than the number of available cores, a warning is issued and the maximum number of available cores is used. Defaults to 1L.

Details

Distances are computed between the SRVFs of the original curves. Hence, they are intrinsically invariant to position. The user can then choose to make distances invariant to rotation and scaling by setting rotation and scale accordingly. Distances can also be made invariant to reparametrization by setting alignment = TRUE, in which case curves are aligned using an appropriate action of the diffeomorphism group on the space of SRVFs.

Value

A list of two objects, Da and Dp, each of class dist containing the amplitude and phase distances, respectively.

References

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

Kurtek, S., Srivastava, A., Klassen, E., and Ding, Z. (2012), “Statistical Modeling of Curves Using Shapes and Related Features,” Journal of the American Statistical Association, 107, 1152–1165.

Srivastava, A., Klassen, E. P. (2016). Functional and shape data analysis, 1. New York: Springer.

Examples

out <- curve_dist(beta[, , 1, 1:4])

fdasrvf documentation built on Oct. 5, 2024, 1:08 a.m.