PAM.cluster: Similarity based clustering

Description Usage Arguments Value Examples

Description

PAM.cluster calculates a clustering using the PAM algorithm (k-medoids). The quality of the clustering is judged using the G1 index.

Usage

1
PAM.cluster(data, min = 2, max = 10, metric = "manhattan")

Arguments

data

A numeric matrix.

min

The minimal number of components that is tested. Must be at least 2.

max

The maximal number of components that is tested.

metric

If empty, data will be treated as a distance matrix. Otherwise, the value will be passed to the call of dist to compute the distance matrix from data

Value

A list with 3 elements. The first element contains the optimal number of components according to the G1 index. The second element contains a vector of the G1 values. The thrid element contains the clustering itself, i.e. the return value of PAM.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
#Random data generation, 10 dimensions, 500 observations, 2 clusters
require("gtools")
data = c()
p = 0.0
for (i in 1:2)
{
temp = c()
for (j in 1:10)
temp = cbind(temp, rbinom(250, 1, p+(i-1)*0.5+(0.025*i)*j))  
data=rbind(data, temp)
}
data = data[permute(1:500),]

PAM.cluster(data)

## End(Not run)

comato documentation built on May 2, 2019, 6:52 a.m.

Related to PAM.cluster in comato...