Create a ggplot summary of gap statistic results
Create a ggplot summary of gap statistic results
plot_clusgap(clusgap, title = "Gap Statistic results")
clusgap |
(Required).
An object of S3 class |
title |
(Optional). Character string.
The main title for the graphic.
Default is |
A ggplot
plot object.
The rendered graphic should be a plot of the gap statistic score
versus values for k
, the number of clusters.
# Load and process data data("soilrep") soilr = rarefy_even_depth(soilrep, rngseed=888) print(soilr) sample_variables(soilr) # Ordination sord = ordinate(soilr, "DCA") # Gap Statistic gs = gapstat_ord(sord, axes=1:4, verbose=FALSE) # Evaluate results with plots, etc. plot_scree(sord) plot_ordination(soilr, sord, color="Treatment") plot_clusgap(gs) print(gs, method="Tibs2001SEmax") # Non-ordination example, use cluster::clusGap function directly library("cluster") pam1 = function(x, k){list(cluster = pam(x, k, cluster.only=TRUE))} gs.pam.RU = clusGap(ruspini, FUN = pam1, K.max = 8, B = 60) gs.pam.RU plot(gs.pam.RU, main = "Gap statistic for the 'ruspini' data") mtext("k = 4 is best .. and k = 5 pretty close") plot_clusgap(gs.pam.RU)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.