Description Usage Arguments Details Value See Also Examples

Compute the Frechet mean

1 2 | ```
meanFrechet(trajLong, timeScale = 0.1, FrechetSumOrMax = "sum",
aggregationMethod = "all", shuffle = TRUE, sampleSize = NA, methodHclust = "average")
``` |

`trajLong` |
[ |

`timeScale` |
[ |

`FrechetSumOrMax` |
[ |

`aggregationMethod` |
[ |

`shuffle` |
[ |

`sampleSize` |
[ |

`methodHclust` |
[ |

Compute the Frechet mean, as define in [1]. The main idea of the algorithm is the following:

The Frechet mean of two trajectories can be easely define as the middle
of the leash that joint the two trajectories (see
`meanFrechet2`

).
Then the mean of n individual can be obtain by merging the individual trajectories two by two, then merging
the resulting trajectories and so on until there is only one trajectory
left. This last trajectory is the Frechet mean. Theoriticaly, the final result depend of the order of agglomeration.
In practice, on large sample, this order has little impact on the final result (see [1] for detail).

So far, three agglomeration methods are availables:

`all`

: the n individuals are scattered (randomly if`shuffle=TRUE`

) on the leaves of a complete binary tree (all the knots have zero or two leaves) having depth h with 2^h <= n <2^h+1. The value of each non-terminal leaf is the Frechet mean for two trajectories of the two children leaves. Frechet mean is thus the value of the tree root. (Informally, this structure is close to that of a tennis tournament). The complexity of this method is O(nt^2).-
`sample`

: This method is the method`all`

applied only to a sample of`sampleSize`

trajectories. The complexity of the method is $O(n^0t^2)$, $n^0$ being the size of the random sample. -
`hierarchical`

: the combination order between individuals is fixed in a deterministic way through an ascending hierarchical classification; the closest individuals being combined first. The complexity of this method is $O(n^2t^2)$.

A `data.frame`

holding a trajectory.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
require(lattice)
### Define artificial data
g <- function(x)dnorm(0:20,runif(1,5,15),2)*rnorm(1,5,1)
dn <- data.frame(id=rep(1:20,each=21),
times=rep((0:20),times=20),
traj=as.numeric(sapply(1:20,g)),
weight=1
)
xyplot(traj ~ times, data=dn, groups=id,type="l",ylim=c(0,1.4))
plot(meanFrechet(dn),ylim=c(0,1.4))
plot(meanFrechet(dn,0.001),ylim=c(0,1.4))
plot(meanFrechet(dn,10),ylim=c(0,1.4))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.