MEDseq (version 1.2.0)

dbs: Compute the Density-based Silhouette

Description

Computes the Density-based Silhouette for a 'soft' clustering assignment matrix.

Usage

dbs(z,
    ztol = 1E-100,
    weights = NULL,
    summ = c("mean", "median"),
    clusters = NULL,
    ...)

Arguments

z

A numeric matrix such that rows correspond to observations, columns correspond to clusters, and rows sum to 1.

ztol

A small (single, numeric, non-negative) tolerance parameter governing whether small assignment probabilities are treated instead as crisp assignments. Defaults to 1E-100.

weights

An optional numeric vector giving observation-specific weights for computing the (weighted) mean/median DBS (see summ).

summ

A single character string indicating whether the (possibly weighted) "mean" (the default) or "median" DBS should be computed.

clusters

Optional/experimental argument for giving the indicator labels of the cluster assignments. Defaults to the MAP assignment derived from z when not supplied. Note that actually supplying the MAP assignment here is slightly less efficient than the NULL default and not advised.

...

Catches unused arguments.

Value

A list with the following elements:

silvals

A matrix where each row contains the cluster to which each observation belongs in the first column and the observation-specific DBS width in the second column.

msw

Depending on the value of summ, either the mean or median DBS width.

wmsw

Depending on the value of summ, either the weighted mean or weighted median DBS width.

References

Menardi, G. (2011). Density-based Silhouette diagnostics for clustering methods. Statistics and Computing, 21(3): 295-308.

See Also

MEDseq_fit

Examples

Run this code
# NOT RUN {
# Generate a toy z matrix
z <- abs(matrix(rnorm(50), ncol=2))
z <- z/rowSums(z)

# Return the median DBS width
dbs(z, summ="median")$msw

# For real sequence data
data(mvad)
# }
# NOT RUN {
mod <- MEDseq_fit(seqdef(mvad[,17:86]), G=11, modtype="UUN", weights=mvad$weight)

dbs(mod$z, weights=mvad$weight)
# }

Run the code above in your browser using DataLab