curveDepth: Tukey Curve Depth and Distance in the Space of Curves

Pavlo Mozharovskyi, Pierre Lafaye de Micheaux, Myriam VimondOpenalex Unknown 2019 · OpenAlex

Abstract

Data recorded as paths or trajectories may be suitably described by curves, which are independent of their parametrization. For the space of such curves, the package provides functionalities for reading curves, sampling points on curves, calculating distance between curves and for computing Tukey curve depth of a curve w.r.t. to a bundle of curves. For details see Lafaye De Micheaux, Mozharovskyi, and Vimond (2021) <a href="https://doi.org/10.48550%2FarXiv.1901.00180" target="_top">doi:10.48550/arXiv.1901.00180</a>.

Introduction

Many real-world data types—GPS trajectories, handwriting, or biological growth patterns—are best represented as curves. However, standard multivariate statistics often struggle with this data because curves can have different lengths, sampling rates, or "speeds" (parametrization). The challenge lies in defining statistical measures like "depth" (a measure of how "central" or "representative" a data point is within a group) and "distance" in a way that respects the geometric shape of the curve rather than just the raw coordinates of the points.

The curveDepth R package addresses this by providing tools that treat curves as pure geometric objects, allowing researchers to perform functional data analysis without being hindered by how the data was recorded. By making calculations independent of parametrization, the tools are robust against variations in how fast a trajectory was traced or how frequently it was sampled.

Methodology and Implementation

The package centers on several novel and standard techniques for curve analysis, primarily implemented through Rcpp and RcppArmadillo for high-performance geometric computation.

Tukey Curve Depth

This is an extension of the classical Tukey (or halfspace) depth to the space of curves. It allows users to determine how "deep" a specific curve is relative to a bundle of other curves. For depth calculation, the package offers an exact method based on the work of Dyckerhoff and Mozharovskyi (2016). For larger datasets where speed is a priority, it provides an approximation method using random projections on a unit hypersphere.

Parameters for the depth.curve.Tukey function, highlighting options for estimation and integration.

As shown in the function parameters, users can control whether to split objects for integration and estimation (subs), the portion of the object used for these tasks (fracInt, fracEst), and whether to use exact or approximate calculations (exactEst).

Distance Metrics and Data Pipelines

The package implements a "minimax" distance metric specifically designed to compare the similarity of two curves. This metric is crucial for clustering and classification tasks where the relative proximity of geometric shapes is the primary feature of interest.

Parameters for the dist.curves function, used for calculating distances between multivariate curves.

To facilitate practical use, the package includes specialized functions like images2curves to convert pixel-based images into ordered paths and voxelize to transform piecewise linear functions into 3D discretized voxel representations. This creates a bridge between geometric computer vision and robust statistics.

Data and Applications

The package includes the mnistShort017 dataset to demonstrate its capabilities. This is a curated subset of the MNIST handwritten digit dataset where digits have been preprocessed into curves through skeletonization.

By calculating the depth of a curve relative to different groups (e.g., the '0's and '1's), researchers can create "DD-plots" (Depth-vs-Depth) to define classification boundaries. Examples within the package documentation show that using Tukey curve depth within the ddalpha classification framework can effectively separate different classes of handwritten digits with high accuracy.

Conclusion

The curveDepth package provides a robust framework for analyzing trajectories and paths as curves, independent of their speed or parametrization. While the exact calculation of Tukey depth in very high dimensions remains computationally intensive, the inclusion of approximation methods and efficient C++ backends makes it a viable tool for modern research in functional data analysis and geometric classification.

Summary updated

BibTeX
@inproceedings{mozharovskyi2019curvedepth,
  author = {Pavlo Mozharovskyi and Pierre Lafaye de Micheaux and Myriam Vimond},
  title = {{curveDepth: Tukey Curve Depth and Distance in the Space of Curves}},
  booktitle = {Openalex Unknown},
  year = {2019},
  doi = {10.32614/cran.package.curvedepth},
}
Figure