Learn R Programming

FrechForest (version 0.8.1)

FrechTree: FrechTree

Description

This function runs Frechet tree for longitudinal data using some shape respecting distance and mean.

Usage

FrechTree(X, Y, id, time, select = "CV", ...)

Arguments

X

[matrix]: a data frame or a matrix of trajectories predictors. Each colunm codes for a trajectory predictor.

Y

[vector]: a vector containing the output trajectories (same length as nrow(X)).

id

[vector (factor)]: identifier, one for each trajectory to attribute each measurement of X and Y to one of the trajectories (same length as Y).

time

[vector]: time measurements for the observations of both X and Y (same length as Y).

select

[character]: a character string indicating which criteria to select the optimal pruned sub-tree, either "CV" for cross validation on the prediction error or "Hubert" for the Hubert's statistics. Default is "CV".

...

: optional parameters to be passed to the low level function

Value

a Frechet treee which is a list of the following elements :

  • feuilles: a vector indicating in which leaf is each measurement.

  • V_split: a matrix of two columns that describes the structure of the tree. Each row codes for a split, the first column indicates the node and the second column gives the associated splitting variable.

  • Y_curves: a list of the predicted trajectories (Frechet mean) for each leaf of the optimal Frechet tree.

  • hist_nodes: a list of the representative trajectories for each node according to the associated splitting variable.

Examples

Run this code
# NOT RUN {
set.seed(10)
data <- DataGenCurves(40)
Ft <- FrechTree(data$X,data$Y, data$id,data$time,select = "Hubert", toPlot="none")
# }

Run the code above in your browser using DataLab