plotBIC {Ckmeans.1d.dp} | R Documentation |
Plot Bayesian Information Criterion as a Function of Number of Clusters
Description
Plot Bayesian information criterion (BIC) as a function of the number of clusters obtained from optimal univariate clustering results returned from Ckmeans.1d.dp
. The BIC normalized by sample size (BIC/n) is shown.
Usage
plotBIC(
ck, xlab="Number of clusters k",
ylab = "BIC/n", type="b",
sub=paste("n =", length(ck$cluster)),
main=paste("Bayesian information criterion",
"(normalized by sample size)", sep="\n"),
...
)
Arguments
ck |
an object of class |
xlab |
a character string. The x-axis label for the plot. |
ylab |
a character string. The x-axis label for the plot. |
type |
the type of plot to be drawn. See |
main |
a character string. The title for the plot. |
sub |
a character string. The subtitle for the plot. |
... |
arguments passed to |
Details
The function visualizes the input data as sticks whose heights are the weights. It uses different colors to indicate optimal k-means clusters. The method to calcualte BIC based on Gaussian mixture models estimated on a univariate clustering is described in (Song and Zhong 2020).
Value
An object of class "Ckmeans.1d.dp
" defined in Ckmeans.1d.dp
.
Author(s)
Joe Song
References
Song M, Zhong H (2020). “Efficient weighted univariate clustering maps outstanding dysregulated genomic zones in human cancers.” Bioinformatics, 36(20), 5027–5036. doi:10.1093/bioinformatics/btaa613.
Examples
# Example: clustering data generated from a Gaussian mixture
# model of two components
x <- rnorm(50, mean=-1, sd=0.3)
x <- append(x, rnorm(50, mean=1, sd=0.3) )
res <- Ckmeans.1d.dp(x)
plotBIC(res)
y <- (rnorm(length(x)))^2
res <- Ckmeans.1d.dp(x, y=y)
plotBIC(res)