Learn R Programming

rtemis (version 1.4.3)

setup_PAMK: Setup PAMKConfig

Description

Setup a PAMKConfig object for Partitioning Around Medoids with estimation of the number of clusters (PAMK), via the 'fpc' package.

Usage

setup_PAMK(
  krange = 2:10,
  criterion = setup_ASWCriterion(),
  use_pam = TRUE,
  scaling = FALSE,
  alpha = 0.001,
  features = NULL
)

Value

PAMKConfig object.

Arguments

krange

Integer [1, Inf) vector: Candidate numbers of clusters to compare. Must include at least one value greater than 1.

criterion

PAMKCriterionConfig: Criterion used to choose the number of clusters, from setup_ASWCriterion, setup_CHCriterion or setup_MultiASWCriterion.

use_pam

Logical: If TRUE, fit each candidate with PAM; if FALSE, with CLARA.

scaling

Logical: If TRUE, scale each variable by its root mean square after centering.

alpha

Numeric [0, 1]: Significance level of the Duda-Hart test, used only when 1 is among the candidates.

features

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

Author

EDG

Details

PAMK fits PAM (or CLARA) for every candidate in krange and keeps the one scoring best under criterion. There is therefore no k to set, and the number of clusters chosen is reported by the resulting Clustering.

Argument names are rtemis' own. They map to fpc::pamk() as: use_pam -> usepam; the criterion's type -> criterion and its n_subsets -> ns; the rest keep their names.

fpc::pamk() also accepts a per-variable numeric vector for scaling; only the logical form is exposed here. Scale by column with preprocess instead, where the decision is recorded and replayed with the data.

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
pamk_config <- setup_PAMK(krange = 2:5)
pamk_config
setup_PAMK(krange = 2:5, criterion = setup_MultiASWCriterion(n_subsets = 20L))

Run the code above in your browser using DataLab