Calculate the bimodality coefficient for a numeric vector as specified in Pfister et al. (2013).

bimodality_coefficient(x, na.rm = FALSE)

Arguments

x

a numeric vector.

na.rm

logical specifying whether missing values should be removed.

Value

A numeric value.

Details

The calculation of the bimodality coefficient involves calculating the skewness and kurtosis of the distribution first. For this, the skew and kurtosi functions of the psych package are used. Note that type is set to "2" for these functions in accordance with Pfister et al. (2013).

References

Pfister, R., Schwarz, K. A., Janczyk, M., Dale, R., & Freeman, J. B. (2013). Good things peak in pairs: A note on the bimodality coefficient. Frontiers in Psychology, 4, 700. http://dx.doi.org/10.3389/fpsyg.2013.00700

See also

skew and kurtosi for calculating skewness and kurtosis.

mt_check_bimodality for assessing bimodality using several methods in a mousetrap data object.

Examples

pfister_data_a <- rep(1:11, times=c(3,5,5,10,17,20,17,10,5,5,3)) bimodality_coefficient(pfister_data_a) #.34
#> [1] 0.3360581
pfister_data_b <- rep(1:11, times=c(2,26,14,6,2,0,2,6,14,26,2)) bimodality_coefficient(pfister_data_b) #.79
#> [1] 0.7946887