The function does hierarchical clustering of the segmented (and joined) series by hclust and performs one of the "intervention" methods (see the respective parameter below) to identify subpopulations. The hierarchical clustering is performed by Euclidean distances using "average" linkage method.

1 | ```
clusterSegments(object, intervention = "groups",pv=NULL,graphics=NULL)
``` |

`object` |
An object of class 'SegTrajectories' |

`intervention` |
intervention: Character. One of "groups","heights" or "pvclust". Option pvclust performs simple hierarchical clustering by hclust and then assesses the uncertainty in the clustering by the bootstrap probability values computed via multi-scale bootstrap resampling. Option "groups" asks the user to input the number of subpopulations we wants to identify (interactive). Option "heights" asks the user to interactively set a threshold T (a horizontal line on the tree plot) that defines the number of subpopulations. |

`pv` |
Supplied p-values for intervention=pvclust. See |

`graphics` |
Character vector. Optional parameter defining the colors for plotting (each color indicates a different subpopulation). Must be at least the length of total number of subpopulations defined. |

The algorithm offers several alternatives for subpopulation estimation that, ultimately, they lead to similar solutions. The user should first visualize the segmented data to get a rough idea of the possible subpopulations (plots generated by the algorithm). Option "pvclust" computes the hierarchical clustering tree with the p-values. The subpopulations are defined interactively by the user (point and click based on the R function `identify()`

; see help(identify)). Alternatively, option "groups" asks the user to input the number of subpopulations or define them interactively in option "height" (point and click at the desired height in the tree). The final plot shows the number of estimated subpopulations.

An object of class SegSeriesTrajectories.

Diana H.P. Low, Efthimios Motakis

Shimodaira, H. (2004) Approximately unbiased tests of regions using multistep-multiscale bootstrap resampling, Annals of Statistics, 32, 2616-2641.

1 2 3 4 5 6 | ```
## Not run:
## interactive!
data(deltaGseg)
traj1.ss<-clusterSegments(traj1.denoise, intervention = "groups") #define clusters by number of groups formed.
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.