dist.array {FKmL} | R Documentation |
Compute Distance Array for Multidimensional Functional Data
Description
This function standardizes multidimensional functional data using provided scaling factors, computes pairwise Fréchet distances between trajectories for each variable, and returns a distance array (3-dimensional array of distance matrices).
Usage
dist.array(dt, time_scale, var_scales)
Arguments
dt |
A long-format data.frame containing the following columns in the specified order:
|
time_scale |
A single numeric value used to scale the |
var_scales |
A numeric vector of scaling factors for the measured variables.
Its length must be equal to |
Details
The dist.array
function first applies scaling to the Time
and each measured variable.
Then, it computes pairwise Fréchet distances between trajectories for each variable separately.
The output is a 3-dimensional array in which each slice corresponds to a variable-specific distance matrix.
Unlike the mfkml
function, which requires at least three measurements across time for each trajectory,
the SFKmL ((Sparse multi-dimensional Fréchet distance-based K-medoids for Longitudinal data), which uses dist.array
,
allows for trajectories with missing values, as long as each variable has at least three time points for each trajectory.
Therefore, dt
may include missing values.
Value
A numeric value or matrix.
If form = "scalar"
, returns the Fréchet distance between the two trajectories as a single numeric value.
If form = "matrix"
, returns the dynamic programming matrix used to compute the distance.
A 3-dimensional array of pairwise distances with dimensions [n, n, p]
, where:
- n
Number of unique trajectories.
- p
Number of variables.
Each slice [, , k]
is a distance matrix for variable k
.