Description Usage Arguments Details Value Author(s) Examples
Function to calculate the total sum of squares (SST) for a given dataset
1 | SST(dataset)
|
dataset |
The dataset for which total sum of squares is returned |
SST computes the total sum of squares, being the distance for observations to the center of gravity, using euclidean distance
The total sum of squares (SST)
Jacob H. Madsen
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.