\Header{pam.object}{Partitioning Around Medoids (PAM) Object}
\keyword{cluster}{pam.object}
\begin{Description}\relax
The objects of class \code{"pam"} represent a partitioning of a
dataset into clusters.
\end{Description}
\begin{Value}
A legitimate \code{pam} object is a list with the following components:
\begin{ldescription}
\item[\code{medoids}] the medoids or representative objects of the
clusters. If a dissimilarity matrix was given as input to
\code{pam}, then a vector of numbers or labels of observations is
given, else \code{medoids} is a matrix with in each row the
coordinates of one medoid.
\item[\code{clustering}] the clustering vector, see \code{\Link{partition.object}}.
\item[\code{objective}] the objective function after the first and second
step of the \code{pam} algorithm.
\item[\code{isolation}] vector with length equal to the number of clusters, specifying which
clusters are isolated clusters (L- or L*-clusters) and which clusters are
not isolated.\\
A cluster is an L*-cluster iff its diameter is smaller than its
separation.  A cluster is an L-cluster iff for each observation i
the maximal dissimilarity between i and any other observation of the
cluster is smaller than the minimal dissimilarity between i and any
observation of another cluster.  Clearly each L*-cluster is also an
L-cluster.

\item[\code{clusinfo}] matrix, each row gives numerical information for one cluster. These
are the cardinality of the cluster (number of observations), the
maximal and average dissimilarity between the observations in the
cluster and the cluster's medoid, 
the diameter of the cluster
(maximal dissimilarity between two observations of the cluster), and
the separation of the cluster (minimal dissimilarity between an
observation of the cluster and an observation of another cluster).

\item[\code{silinfo}] list with silhouette width information, see
\code{\Link{partition.object}}.
\item[\code{diss}] dissimilarity (maybe NULL), see \code{\Link{partition.object}}.
\item[\code{call}] generating call, see \code{\Link{partition.object}}.
\item[\code{data}] (possibibly standardized) see \code{\Link{partition.object}}.
\end{ldescription}
\end{Value}
\begin{Section}{GENERATION}
These objects are returned from \code{\Link{pam}}.
\end{Section}
\begin{Section}{METHODS}
The \code{"pam"} class has methods for the following generic functions:
\code{print}, \code{summary}.
\end{Section}
\begin{Section}{INHERITANCE}
The class \code{"pam"} inherits from \code{"partition"}.
Therefore, the generic functions \code{plot} and \code{clusplot} can
be used on a \code{pam} object.
\end{Section}
\begin{SeeAlso}\relax
\code{\Link{pam}}, \code{\Link{dissimilarity.object}},
\code{\Link{partition.object}}, \code{\Link{plot.partition}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Use the silhouette widths for assessing the best number of clusters,
## following a one-dimensional example from Christian Hennig :
##
x <- c(rnorm(50), rnorm(50,mean=5), rnorm(30,mean=15))
asw <- numeric(20)
## Note that "k=1" won't work!
for (k in 2:20)
  asw[k] <- pam(x, k) $ silinfo $ avg.width
k.best <- which.max(asw)
cat("silhouette-optimal number of clusters:", k.best, "\n")

plot(1:20, asw, type= "h", main = "pam() clustering assessment",
     xlab= "k  (# clusters)", ylab = "average silhouette width")
axis(1, k.best, paste("best",k.best,sep="\n"), col = "red", col.axis = "red")
\end{ExampleCode}
\end{Examples}

