numberclust_plot: Plot most important diagnostics and indices for best number...

View source: R/FleetSegmentation.R

numberclust_plotR Documentation

Plot most important diagnostics and indices for best number of clusters

Description

This function uses a scree plot of the explained variation, the average silhouettes, the Mantel test and a dendrogram for estimating the best number of clusters for the clustering. It creates a plotgrid with a scree plot (upper left), a plot of the average silhouette score including the maximum (upper right), a plot of the Mantel test including the best result (lower left) and a dendrogram of the clustering (lower left). The dendrogram can either be displayed without any further features or with the recommended cutting heights (setting dend_method to "range") or a cut at a defined linkage distance (setting dend_method to "cut").

Usage

numberclust_plot(
  catchdata,
  max_clusternumber = ifelse(nrow(catchdata) <= 15, (nrow(catchdata) - 1), 15),
  distance = "jaccard",
  method = "average",
  dend_method = "basic",
  dend_cut = 0.75,
  range_min = 0.4,
  range_max = 0.8
)

Arguments

catchdata

The transformed catchdata created with catchdata_transformation()

max_clusternumber

The maximum number of clusters to be expected. Defaults to 1 less than the number of ships in the catchdata-frame, up to a maximum of 15.

distance

The distance measure used. Defaults to modified (metric-converted) Bray-Curtis distance. CAUTION! The clustering approach for the fleet segmentation is designed to work with modified (metric-converted) Bray-Curtis distance and the average linkage method! Changing either of them is not advised!

method

The link function used. Defaults to average linkage. CAUTION! The clustering approach for the fleet segmentation is designed to work with modified (metric-converted) Bray-Curtis distance and the average linkage method! Changing either of them is not advised!

dend_method

The style of the plotted dendrogram. "basic" returns a blank dendrogram, "range" a dendrogram with the recommended cutting heights depicted, "cut" enables the user to cut the dendrogram at a height of his choice. The resulting number of clusters will be shown in the plot.

dend_cut

The height used to cut the dendrogram. Defaults to 0.75, which showed to be the appropriate cutting height for various fleet data sets.

range_min

The lower border of the cutting range set for a dendrogram with the "range"- method

range_max

The upper border of the cutting range set for a dendrogram with the "range"- method

Examples

library(tidyverse)
data <- example_catchdata
stockdata <- assign_stocks(data=data)
catchdata <- catchdata_transformation(data = stockdata)
numberclust_plot(catchdata = catchdata,max_clusternumber = 15)

ESulanke/FleetSegmentation documentation built on March 27, 2023, 10:13 p.m.