Learn R Programming

fdapace (version 0.6.0)

FClust: Functional clustering and identifying substructures of longitudinal data

Description

Default: Cluster functional data using the functional principal component (FPC) scores obtained from the data FPC analysis using EMCluster (Chen and Maitra, 2015) or directly clustering the functional data using kCFC (Chiou and Li, 2007).

Usage

FClust(Ly, Lt, k = 3, cmethod = "EMCluster", optnsFPCA = NULL, optnsCS = NULL)

Value

A list containing the following fields:

cluster

A vector of levels 1:k, indicating the cluster to which each curve is allocated.

fpca

An FPCA object derived from the sample used by Rmixmod, otherwise NULL.

clusterObj

Either a EMCluster object or kCFC object.

Arguments

Ly

A list of n vectors containing the observed values for each individual. Missing values specified by NAs are supported for dense case (dataType='dense').

Lt

A list of n vectors containing the observation time points for each individual corresponding to y.

k

A scalar defining the number of clusters to define; default 3.

cmethod

A string specifying the clustering method to use ('EMCluster' or 'kCFC'); default: 'EMCluster'.

optnsFPCA

A list of options control parameters specified by list(name=value) to be used for by FPCA on the sample y; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.90, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA'.

optnsCS

A list of options control parameters specified by list(name=value) to be used for cluster-specific FPCA from kCFC; by default: "list( methodMuCovEst ='smooth', FVEthreshold= 0.70, methodBwCov = 'GCV', methodBwMu = 'GCV' )". See `Details in ?FPCA' and '?kCFC'.

Details

Within EMCluster, uses the model initiated EMCluster::em.EM and returns the optimal model based on EMCluster::emcluster. See ?EMCluster::emcluster for details.

References

Wei-Chen Chen and Ranjan Maitra, "EMCluster: EM Algorithm for Model-Based Clustering of Finite Mixture Gaussian Distribution". (2015)

Julien Jacques and Cristian Preda, "Funclust: A curves clustering method using functional random variables density approximation". Neurocomputing 112 (2013): 164-171

Jeng-Min Chiou and Pai-Ling Li, "Functional clustering and identifying substructures of longitudinal data". Journal of the Royal Statistical Society B 69 (2007): 679-699

Examples

Run this code
# \donttest{
data(medfly25)
Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs) 
newClust <- FClust(Flies$Ly, Flies$Lt, k = 2, optnsFPCA = 
                    list(methodMuCovEst = 'smooth', userBwCov = 2, FVEthreshold = 0.90))
                    
# We denote as 'veryLowCount' the group of flies that lay less
# than twenty-five eggs during the 25-day period examined.

veryLowCount = ifelse( sapply( unique(medfly25$ID), function(u) 
                   sum( medfly25$nEggs[medfly25$ID == u] )) < 25, 0, 1)
N <- length(unique(medfly25$ID))
(correctRate <- sum( (1 + veryLowCount) ==  newClust$cluster) / N) # 99.6%
# }

Run the code above in your browser using DataLab