Learn R Programming

longitudinalData (version 2.1.2)

distFrechet: ~ Function: Frechet distance ~

Description

Compute Frechet distance between two trajectories.

Usage

distFrechet(P, Q, method = "max", Fdist = dist)

Arguments

P
[vector(numeric)] First trajectories.
Q
[vector(numeric)] First trajectories.
method
[character] Method used. Can be either 'max' or 'sum'
Fdist
[numeric <- function(numeric,numeric)] Frechet distance between two trajectories use a distance that is use the compute the distance between points of the trajectories. Fdist can be used to define a specific distance. The special value "2D" is us

Value

  • A numeric value.

Author

Christophe Genolini 1. UMR U1027, INSERM, Universit� Paul Sabatier / Toulouse III / France 2. CeRSM, EA 2931, UFR STAPS, Universit� de Paris Ouest-Nanterre-La D�fense / Nanterre / France

Details

Given two curve P and Q and a distance d, Frechet distance between P and Q is define as inf_{a,b} max_{t} d(P(a(t)),Q(b(t))). It's computation is a NP-complex problem. When P and Q are trajectories (discrete curve), the problem is polynomial (and quite simple). The Frechet distance can also be define using a sum instead of a max: inf_{a,b} sum_{t} d(P(a(t)),Q(b(t)))

References

[1] Thomas Eiter & Heikki Mannila: "Computing Discrete Fr�echet Distance" [2] C. Genolini and B. Falissard "KmL: k-means for longitudinal data" Computational Statistics, vol 25(2), pp 317-328, 2010 [3] C. Genolini and B. Falissard "KmL: A package to cluster longitudinal data" Computer Methods and Programs in Biomedicine, 104, pp e112-121, 2011

See Also

distTraj

Examples

Run this code
P <- rnorm(7)
   Q <- rnorm(6)

   ### Function from Eiter and Mannila compiled in C
   distFrechet(P,Q)

   ### Frechet using sum instead of max.
   distFrechet(P,Q,method="sum")

   ### Frechet using "manhattan" distance
   distFrechet(P,Q,Fdist=function(x)dist(x,method="manhattan"))

Run the code above in your browser using DataLab