meanFrechet2: ~ Function: meanFrechet2 ~

Description Usage Arguments Details Value Examples

Description

Compute the Frechet mean between two curves.

Usage

1
meanFrechet2(Px, Py, Qx, Qy, timeScale = 0.1, FrechetSumOrMax = "sum", weightPQ = c(1,1))

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

[numeric]: allow to modify the time scale, increasing or decreasing the cost of the horizontal shift. If timeScale is very big, then the Frechet's mean is equal to the euclidienne distance. If timeScale is very slow, then it is equal to the Dynamic Time Warping.

FrechetSumOrMax

[character]: Like Frechet's distance, Frechet's mean can be define using the 'sum' function or the 'max' function. This option let the user to chose one or the other.

weightPQ

[couple(numeric)]: respective weight of the two trajectories (for a weighted mean).

Details

Given two curve P and Q

The Frechet distance, path and means can also be define using a sum instead of a max.

Value

A numeric value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
traj <- matrix(0,4,5)
traj[1,2] <- 10
traj[2,3] <- 11
traj[3,4] <- 10
traj[4,2] <- 8

matplot(x=1:5,y=t(traj),type="l",col=2:5,lty=1)
m12 <- meanFrechet2(Px=1:5,Py=traj[1,],Qx=1:5,Qy=traj[2,])
m34 <- meanFrechet2(Px=1:5,Py=traj[3,],Qx=1:5,Qy=traj[4,])
lines(m12,col=2,lwd=3)
lines(m34,col=2,lwd=3)

m1234 <- meanFrechet2(Px=m12$times,Py=m12$traj,Qx=m34$times,Qy=m34$traj)
lines(m1234,col=1,lwd=5)

kmlShape documentation built on May 1, 2019, 7:50 p.m.