SST: Sum of total squares for data

Description Usage Arguments Details Value Author(s) Examples

Description

Function to calculate the total sum of squares (SST) for a given dataset

Usage

1
SST(dataset)

Arguments

dataset

The dataset for which total sum of squares is returned

Details

SST computes the total sum of squares, being the distance for observations to the center of gravity, using euclidean distance

Value

The total sum of squares (SST)

Author(s)

Jacob H. Madsen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Select a dataset to standardize and cluster
X <- scale(iris[,1:4])

## Cluster the dataset with a given number of clusters
cluster.obj <- hclust(dist(X), method='complete')

## Cut the hierarchical clustering tree
chosen.clusters <- cutree(cluster.obj, 3)

## Evaluate the clustering results with 'SSE' and 'SST'
clusters.SSE <- SSE(X, chosen.clusters)$sumWithin
clusters.SST <- SST(X)

## Calculate the r-squared for your cluster solution
rsq <- 1-(clusters.SSE/clusters.SST)

print(rsq)

jhmadsen/ClustTools documentation built on May 24, 2019, 9:54 p.m.