bending_index: The elbow rule to define the proper number of clusters.

Description Usage Arguments Details Value Author(s) Examples

View source: R/bending_index.R

Description

Given a GRanges object with metadata columns related to the classification performed with the cluster_peak method, this function quantifies the elbow rule. See Details for a short presentation of the method and the Vignette of the package for a complete defintion of the index.

Usage

1
bending_index(object, plot.graph.k = FALSE)

Arguments

object

GRanges object. It must contain the metadata columns associated to the classification to be analyzed. Specifically it must contain the cluster_NOshift metadata (and the correspondent set of distances distance_NOshift) if the user wants to compute the bending index for the non aligned peaks and/or the cluster_shift metadata (and the correspondent set of distances distance_shift) if the user wants to compute the bending index for the classification with alignment.

plot.graph.k

logical. If TRUE the graph of the global distance between the data and corresponding center of the cluster, varying the number of clusters is plotted. Distances are normalized with the total number of peaks n. These are the distances uesd to compute the bending index, as presented in Details. If object contains both the results with and without the classification, two lines are drown to show, beside the variation of the distance with an increase of k, also the decrease of the global distance introduced by the alignment procedure. If a single classification is stored in the object, only one line is drawn. Default is FALSE.

Details

This function consists of the computation for each feasible value of k (from 2 to K ??? 1, with K the maximum number of clusters) of an index that quantifies the magnitude of the elbow. As higher is this index, as the correspondent value of k is meaningful. Specifically it is computed as the distance of the point in k of the global distance function (normalized with the maximum value it assumes) from the line passing by the point in k ??? 1 and in k + 1. For further details, see the Vignette.

Value

The function returns

Author(s)

Alice Parodi, Marco J. Morelli, Laura M. Sangalli, Piercesare Secchi, Simone Vantini

Examples

1
2
3
4
5
6
7
8
# load the data
data(peaks)

# compute the bending index
index <- bending_index(peaks.data.cluster, plot.graph.k = FALSE)
# from the analysis of this results, a choice of k=3 for
# the classification with shift and k=2 for the classification 
# without shift is suggested.

FunChIP documentation built on Nov. 8, 2020, 4:50 p.m.