#' calculate_sarles_bimodality
#'
#' Calculates Sarle's bimodality metric, which provides a measure of a skewness when the given distribution is unimodal.
#'
#' @param data A vector of integer counts.
#'
#' @return A numeric value.
#' @export
#' @importFrom moments skewness kurtosis
#' @author Alex T. Kalinka \email{alex.kalinka@@cancer.org.uk}
calculate_sarles_bimodality <- function(data){
tryCatch({
return((moments::skewness(data)^2+1)/moments::kurtosis(data))
},
error = function(e) stop(paste("unable to calculate Sarle's bimodality metric:",e))
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.