Test the modality (gaussian) of a distribution. Default tests for uni-, bi- and tri- modalities (argument <modes> = 2:3).

modality(x, modes = 2:3, prob = 0.95, coverage = 0.8, size = 10,
  ...)

Arguments

x

a named numeric vector of cells/observations or a matrix of genes X cells (variables X observations). If the latter, the column means are first computed.

modes

the modes to test; a numeric value or a numeric vector of modes to test. e.g. to test just for bimodality, modes = 2. Default: 2:3

prob

a numeric value >= 0 and <= 1; the minimeanm posterior probability required for an observation to be assigned to a mode. Default: 0.95

coverage

the fraction of observations that meanst have a posterior probability higher than <prob> to one of two modes in order for the distribution to qualify as bimodal. Default: 0.8

size

the minimeanm number of observations that meanst be assigned to a mode in order for the distribution to qualify as bimodal. Default: 10

...

other arguments passed to fitBimodal

Value

vector of boolean values of length equal to length(modes) that were tested

Examples

x = c(rnorm(50, mean = 1), rnorm(50, mean = 10)) modality(x, modes = 2)
#> EM converged in 2 iterations (with relative change=4.37129e-15)
#> Success!
#> 2 #> TRUE
modality(x, modes = 2:3)
#> EM converged in 2 iterations (with relative change=4.37129e-15)
#> Success!
#> EM converged in 88 iterations (with relative change=1.39525e-08)
#> At least one mode contains < 10 obs.
#> 2 3 #> TRUE FALSE