pamward: PAM from k-solution of hierarchical clustering

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/pamward.R

Description

Runs a pam clustering (pam) from the solution in k groups of a hierarchical clustering (agnes) .

Usage

1
pamward(diss, k=3, method="ward", dist)

Arguments

diss

Distance matrix or object.

k

Integer. Number of clusters.

method

Method for the hierarchical clustering (see agnes).

dist

Deprecated. Use diss instead.

Details

The function first runs the hierarchical clustering, retrieves the medoids of the solution for the provided k and uses those medoids as start centers for the pam partitioning.

Value

An object of class "pam". See pam.object for details.

Author(s)

Gilbert Ritschard

See Also

agnes and pam.

Examples

1
2
3
4
5
6
library(cluster)
data(actcal)
actcal.seq <- seqdef(actcal[1:200,13:24])
actcal.ham <- seqdist(actcal.seq, method = "HAM")
clust <- pamward(actcal.ham, k = 4)
table(clust$clustering)

Example output

Loading required package: TraMineR

TraMineR stable version 2.0-9 (Built: "Sun,)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.

TraMineRextras stable version 0.4.1 (Built: 2017-09-21)
Functions provided by this package are still in test
    and subject to changes in future releases.
 [>] 4 distinct states appear in the data: 
     1 = A
     2 = B
     3 = C
     4 = D
 [>] state coding:
       [alphabet]  [label]  [long label] 
     1  A           A        A
     2  B           B        B
     3  C           C        C
     4  D           D        D
 [>] 200 sequences in the data set
 [>] min/max sequence length: 12/12
 [>] 200 sequences with 4 distinct states
 [>] creating a 'sm' with a single substitution cost of 1
 [>] creating 4x4 substitution-cost matrix using 1 as constant value
 [>] 39 distinct sequences
 [>] min/max sequence length: 12/12
 [>] computing distances using the HAM metric
 [>] elapsed time: 0.009 secs

 1  2  3  4 
34 81 19 66 

TraMineRextras documentation built on June 25, 2021, 1:06 a.m.