DianaParam-class: Divisive analysis clustering

DianaParam-classR Documentation

Divisive analysis clustering

Description

Use the diana function to perform divisive analysis clustering.

Usage

DianaParam(
  metric = NULL,
  dist.fun = NULL,
  stand = NULL,
  cut.fun = NULL,
  cut.dynamic = FALSE,
  cut.params = list()
)

## S4 method for signature 'ANY,DianaParam'
clusterRows(x, BLUSPARAM, full = FALSE)

Arguments

metric

String specifying the distance metric to use in diana. If NULL, the default metric is used. If dist.fun is supplied, metric is passed to that function instead.

dist.fun

Function specifying the function to use to compute the distance matrix. The function should accept a data matrix and a method= string (used to accept metric) and return a dissimilarity matrix of type dist. If NULL, the stats::dist function is used by default.

stand

Further arguments to pass to diana.

cut.fun

Function specifying the method to use to cut the dendrogram. The first argument of this function should be the output of hclust, and the return value should be an atomic vector specifying the cluster assignment for each observation. Defaults to cutree if cut.dynamic=FALSE and cutreeDynamic otherwise.

cut.dynamic

Logical scalar indicating whether a dynamic tree cut should be performed using the dynamicTreeCut package.

cut.params

Further arguments to pass to cut.fun.

x

A numeric matrix-like object where rows represent observations and columns represent variables.

BLUSPARAM

A HclustParam object.

full

Logical scalar indicating whether the hierarchical clustering statistics should be returned.

Details

To modify an existing DianaParam object x, users can simply call x[[i]] or x[[i]] <- value where i is any argument used in the constructor.

If cut.fun=NULL, cut.dynamic=FALSE and cut.params does not have h or k, clusterRows will automatically set h to half the tree height when calling cutree.

Value

The DianaParam constructor will return a DianaParam object with the specified parameters.

The clusterRows method will return a factor of length equal to nrow(x) containing the cluster assignments. If full=TRUE, a list is returned with clusters (the factor, as above) and objects (a list containing diana, the function output; dist, the dissimilarity matrix; and hclust, a hclust object created from diana).

Author(s)

Aaron Lun

See Also

diana, which actually does all the heavy lifting.

HclustParam, for the more commonly used implementation of hierarchical clustering.

Examples

clusterRows(iris[,1:4], DianaParam())
clusterRows(iris[,1:4], DianaParam(metric="manhattan"))


LTLA/bluster documentation built on Aug. 20, 2023, 5:39 a.m.