setup_PAMK: Setup PAMKConfig

View source: R/120_ClusteringConfig.R

setup_PAMKR Documentation

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
)

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.

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.

Value

PAMKConfig object.

Author(s)

EDG

References

Kaufman L, Rousseeuw PJ (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/9780470316801")}

Examples

pamk_config <- setup_PAMK(krange = 2:5)
pamk_config
setup_PAMK(krange = 2:5, criterion = setup_MultiASWCriterion(n_subsets = 20L))

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.