distFrechet {longitudinalData} | R Documentation |
~ Function: Frechet distance ~
Description
Compute Frechet distance between two trajectories.
Usage
distFrechet(Px,Py,Qx, Qy, timeScale=0.1, FrechetSumOrMax = "max")
Arguments
Px |
[vector(numeric)] Times (abscisse) of the first trajectories. |
Py |
[vector(numeric)] Values of the first trajectories. |
Qx |
[vector(numeric)] Times of the second trajectories. |
Qy |
[vector(numeric)] Values of the second trajectories. |
timeScale |
[ |
FrechetSumOrMax |
[ |
Details
Given two curve P and Q, 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.
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)))
The function distFrechet
is C compiled,
the function distFrechetR
is in R,
the function distFrechetRec
is in recursive (the slowest) in R.
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
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
Px <- 1:20
Py <- dnorm(1:20,12,2)
Qx <- 1:20
Qy <- dnorm(1:20,8,2)
distFrechet(Px,Py,Qx,Qy)
### Frechet using sum instead of max.
distFrechet(Px,Py,Qx,Qy,FrechetSumOrMax="sum")