wss_plot: Within groups sum of squares plot

Description Usage Arguments Details Value Examples

View source: R/wss_plot.R

Description

Within Groups Sum of Squares Plot

Usage

1
wss_plot(data, nc = 15, standardize = TRUE, seed = 1234)

Arguments

data

a data frame of numeric variables.

nc

integer. The largest number of clusters to evaluate.

standardize

logical. If TRUE, standardize data before clustering.

seed

integer. A random number seed for reproducablility.

Details

wss_plot generates a plot of within-groups sums-of-squares vs. number of clusters based on k-means clustering. The clustering uses euclidean distances between observations. By default, the variables are standardized (recommended). The plot is useful for determining the number of clusters present in the data. Look for the point were adding clusters does not significantly decrease the within-groups sum-of-squares.

Value

a ggplot2 graph

Examples

1
2
3
# iris example (should find 3 clusters)
data(iris)
wss_plot(iris[-5])

Rkabacoff/qacr documentation built on March 20, 2021, 3:03 p.m.