# funhclust: Functional Hierarchical Clustering In T4cluster: Tools for Cluster Analysis

## Description

Given N curves γ_1 (t), γ_2 (t), …, γ_N (t) : I \rightarrow \mathbf{R}, perform hierarchical agglomerative clustering with fastcluster package's implementation of the algorithm. Dissimilarity for curves is measured by L_p metric.

## Usage

 1 2 3 4 5 6 7 funhclust( fdobj, p = 2, method = c("single", "complete", "average", "mcquitty", "ward.D", "ward.D2", "centroid", "median"), members = NULL ) 

## Arguments

 fdobj a 'fd' functional data object of N curves by the fda package. p an exponent in L_p formalism (default: 2). method agglomeration method to be used. This must be one of "single", "complete", "average", "mcquitty", "ward.D", "ward.D2", "centroid" or "median". members NULL or a vector whose length equals the number of observations. See hclust for details.

## Value

an object of class hclust. See hclust for details.

## References

\insertRef

ferreira_comparison_2009T4cluster

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 # ------------------------------------------------------------- # two types of curves # # type 1 : sin(x) + perturbation; 20 OF THESE ON [0, 2*PI] # type 2 : cos(x) + perturbation; 20 OF THESE ON [0, 2*PI] # ------------------------------------------------------------- ## PREPARE : USE 'fda' PACKAGE # Generate Raw Data datx = seq(from=0, to=2*pi, length.out=100) daty = array(0,c(100, 40)) for (i in 1:20){ daty[,i] = sin(datx) + rnorm(100, sd=0.1) daty[,i+20] = cos(datx) + rnorm(100, sd=0.1) } # Wrap as 'fd' object mybasis <- fda::create.bspline.basis(c(0,2*pi), nbasis=10) myfdobj <- fda::smooth.basis(datx, daty, mybasis)\$fd ## RUN THE ALGORITHM hcsingle = funhclust(myfdobj, method="single") ## VISUALIZE opar <- par(no.readonly=TRUE) par(mfrow=c(1,3)) matplot(datx, daty[,1:20], type="l", main="Curves Type 1") matplot(datx, daty[,21:40], type="l", main="Curves Type 2") plot(hcsingle, main="hclust with 'single' linkage") par(opar) 

T4cluster documentation built on Aug. 16, 2021, 9:07 a.m.