
Computes the distance matrix for functional data with amplitude and phase separation
Source:R/fdadist.R
fdadist.RdThis function computes the matrix of pairwise distances between curves a functional data sample. This can be achieved with or without phase and amplitude separation, which can be done using a variety of warping classes.
Arguments
- x
A numeric vector of length \(M\) or a numeric matrix of shape \(N \times M\) or an object of class
funData::funData. If a numeric vector or matrix, it specifies the grid(s) of size \(M\) on which each of the \(N\) curves have been observed. If an object of classfunData::funData, it contains the whole functional data set and theyargument is not used.- y
Either a numeric matrix of shape \(N \times M\) or a numeric array of shape \(N \times L \times M\) or an object of class
fda::fd. If a numeric matrix or array, it specifies the \(N\)-sample of \(L\)-dimensional curves observed on grids of size \(M\). If an object of classfda::fd, it contains all the necessary information about the functional data set to be able to evaluate it on user-defined grids.- is_domain_interval
A boolean specifying whether the sample of curves is defined on a fixed interval. Defaults to
FALSE.- transformation
A string specifying the transformation to apply to the original sample of curves. Choices are no transformation (
transformation = "identity") or square-root velocity functiontransformation = "srvf". Defaults to"identity".- warping_class
A string specifying the class of warping functions. Choices are no warping (
warping_class = "none"), shifty = x + b(warping_class = "shift"), dilationy = ax(warping_class = "dilation"), affiney = ax + b(warping_class = "affine") or boundary-preserving diffeomorphism (warping_class = "bpd"). Defaults to"none".- metric
A string specifying the metric used to compare curves. Choices are
"l2","normalized_l2"or"pearson". Iftransformation == "srvf", the metric must be"l2"because the SRVF transform maps absolutely continuous functions to square-integrable functions. Iftransformation == "identity"andwarping_classis eitherdilationoraffine, the metric cab be either"normalized_l2"or"pearson". The L2 distance is indeed not dilation-invariant or affine-invariant. The metric can also be"l2"ifwarping_class == "shift". Defaults to"l2".- cluster_on_phase
A boolean specifying whether clustering should be based on phase variation or amplitude variation. Defaults to
FALSEwhich implies amplitude variation.- labels
A character vector specifying curve labels. Defaults to
NULLwhich uses sequential numbers as labels.
Value
A stats::dist object storing the distance matrix between the input
curves using the metric specified through the argument metric and the
warping class specified by the argument warping_class.
Examples
idx <- c(1:5, 11:15, 21:25)
D <- fdadist(simulated30_sub$x[idx, ], simulated30_sub$y[idx, , ])