Learn R Programming

rtemis (version 1.4.3)

setup_PAM: Setup PAMConfig

Description

Setup a PAMConfig object for Partitioning Around Medoids (PAM) clustering, via the 'cluster' package.

Usage

setup_PAM(
  k = 3L,
  dist = "euclidean",
  stand = FALSE,
  do_swap = TRUE,
  variant = "original",
  nstart = NULL,
  features = NULL
)

Value

PAMConfig object.

Arguments

k

Integer [1, Inf): Number of clusters. Must be fewer than the number of cases.

dist

Character {"euclidean", "manhattan"}: Distance measure to use.

stand

Logical: If TRUE, standardize each variable before computing dissimilarities.

do_swap

Logical: If TRUE, perform the swap phase.

variant

Character {"original", "o_1", "o_2", "f_3", "f_4", "f_5", "faster"}: Algorithm variant; "original" is the published algorithm, the others trade exactness for speed.

nstart

Optional Integer [1, Inf): Number of random starts. NULL uses the deterministic build phase instead of drawing the initial medoids at random.

features

Optional Character vector: Names of at least 2 distinct feature columns to cluster on. NULL clusters on all numeric features.

Author

EDG

Details

PAM is the medoid-based counterpart of k-means: each cluster is represented by one of the cases, which makes it usable with non-Euclidean dissimilarities and less sensitive to outliers.

Argument names are rtemis' own. They map to cluster::pam() as: dist -> metric, do_swap -> do.swap; the rest keep their names.

References

Kaufman L, Rousseeuw PJ (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley. tools:::Rd_expr_doi("10.1002/9780470316801")

Examples

Run this code
pam_config <- setup_PAM(k = 3L)
pam_config

Run the code above in your browser using DataLab