bimod_coef: Compute bimodality coefficient

View source: R/bimod_coef.R

bimod_coefR Documentation

Compute bimodality coefficient

Description

Computes the bimodality coefficient for a vector of data points (for a tutorial, see Pfister et al., 2013, Frontiers in Quantitative Psychology and Measurement).

Usage

bimod_coef(data, moments = FALSE, na.rm = TRUE)

Arguments

data

A vector containing the data.

moments

A logical specifying whether the sample moments skewness and kurtosis should be contained in the output.

na.rm

A logical specifying whether NAs should be removed from the data vector.

Value

bimod_coef(data) returns a bimodality coefficient for the input data; bimod_coef(data,moments=TRUE) returns a vector with three elements: the bimodality coefficient, skewness of the data, and sample kurtosis of the data.

Author(s)

Moritz Schaaf, Roland Pfister

See Also

rank; ntiles;

Examples

# Input slightly bimodal data
data <- c( 3, 5, 5, 5, 5, 7, 10, 17, 18, 18, 19, 19, 20)

# Show histogram
hist(data,breaks=c(0:20),include.lowest=FALSE,
     ylim=c(0,5),xlim=c(0,20))

# Compute bimodality coefficient
bimod_coef(data)

# Get bimodality coefficient, skewness, and kurtosis
bimod_coef(data,moments=TRUE)

schoRsch documentation built on April 3, 2025, 6:11 p.m.