PAM: Clustering using _K_-medoids (PAM)

PAMR Documentation

Clustering using K-medoids (PAM)

Description

Partitions the data into k clusters around medoids – actual observations of the dataset – rather than around means. Being an observation, a medoid can be shown to students as a representative example of its cluster, and the method tolerates outliers much better than K-means, which drags a mean towards them.

Usage

PAM(
  d,
  k = 9,
  criterion = c("none", "silhouette"),
  graph = FALSE,
  seed = NULL,
  ...
)

Arguments

d

The dataset (matrix or data.frame).

k

The number of clusters.

criterion

How k is chosen, as in KMEANS. With "none" (the default) k is used as it is; with "silhouette" it is chosen between 2 and k by the mean silhouette width, the criterion PAM itself optimises the closest.

graph

A logical indicating whether the criterion curve is plotted.

seed

A specified seed for random number generation. PAM's initialisation is deterministic, so this only matters for the criterion search.

...

Other parameters, passed to pam.

Value

The clustering, as an object of class pam (see pam), with a cluster component holding the assignments and a medoids one holding the representative observations.

See Also

KMEANS, pam, kmeans.getk

Examples

require (datasets)
data (iris)
model = PAM (iris [, -5], 3)
model$medoids
table (model$cluster, iris [, 5])

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.