| trajClusters | R Documentation |
Classifies the trajectories by applying a nonparametric clustering algorithm to the measures computed by trajMeasures().
trajClusters(
Measures,
select = NULL,
fuzzy = FALSE,
nclusters = NULL,
subset.n = NULL,
nstart = 50
)
## S3 method for class 'trajClusters'
print(x, ...)
## S3 method for class 'trajClusters'
summary(object, ...)
Measures |
object of class |
select |
an optional vector of positive integers corresponding to the
measures to use in the clustering. Defaults to |
fuzzy |
logical. If FALSE, each trajectory is assigned to a unique group. If TRUE, each trajectory is assigned a "degree of membership" to each group. Defaults to FALSE. |
nclusters |
The desired number of clusters. If |
subset.n |
A positive numerical integer smaller than the number of trajectories. If |
nstart |
The number of random starts. Defaults to |
x |
object of class |
... |
further arguments passed to or from other methods. |
object |
object of class |
The spectral clustering algorithm presented in Meila (2005) is implemented in which the similarity matrix S is built from a binary K nearest neighbors similarity function (S=(W+W^T)/2, where W_{ij}=1 if data point j is among the nearest points to data point i and W_{ij}=0 otherwise).
An object of class trajClusters; a list containing the result of the clustering, as well as a curated form of the arguments. If nclusters is set to NULL, clustering is carried out for each number k of clusters between 2 and (up to) 8 and a plot is produced representing the value of three internal cluster validity indices (C-index, Calinski-Harabasz, Wemmert-Gancarski) as a function of k. As in the 'KmL' package of Genolini et al., these validity indices are presented on a scale from 0 to 1, with 1 corresponding to the highest validity score and 0 corresponding to the lowest. From this, a "best" value of k is determined using a ranked voting system.
Genolini, C. et al., kml: K-Means for Longitudinal Data, https://CRAN.R-project.org/package=kml
Meila, M., Spectral Clustering. Handbook of Cluster Analysis, Chapter 7, Chapman and Hall/CRC, 2005.
## Not run:
data("trajdata")
trajdata.noGrp <- trajdata[, -which(colnames(trajdata) == "Group")] # remove the Group column
m = trajMeasures(trajdata.noGrp, ID = TRUE, measures = 1:19)
s2.3 <- trajClusters(m, nclusters = 3)
plot(s2.3)
#'s2.4 <- trajClusters(m, nclusters = 4)
plot(s2.4)
#'s2.5 <- trajClusters(m, nclusters = 5)
plot(s2.5)
groups <- s2.4 <- trajClusters(m, nclusters = 4)$partition
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.