# is.unimodal: Test if moments come from a unimodal distribution with... In CharlotteJana/momcalc: Symbolic Moment Calculation

## Description

Given a compact support `[A, B]` and moments `m1, m2, ...` of a one dimensional distribution, this method checks if the (unknown) distribution can be unimodal.
There exist several inequalities that test for nonunimodality (see References). Depending on the inequality, moments up to order 2 or 4 are required. A distribution that satisfies all inequalities that contain only moments up to order 2 is called 2-b-unimodal. A distribution that satisfies all inequalities that contain only moments up to order 4 is called 4-b-unimodal. The internal methods `is.2_b_unimodal` and `is.4_b_unimodal` test these inequalities. Method `is.unimodal` performs these checks, depending on the number of given moments. It is possible that a multimodal distribution satisfies all inequalities and is therefore 2- and even 4-bimodal (see the examples below). But if at least one of the inequalities is not satisfied, the distribution cannot be unimodal.

## Usage

 ```1 2 3 4 5``` ```is.unimodal(lower, upper, moments, eps = 1e-10) is.2_b_unimodal(lower, upper, moments, eps = 1e-10) is.4_b_unimodal(lower, upper, moments, eps = 1e-10) ```

## Arguments

 `lower` numeric or vector. The lower bound(s) A of the support [A, B] of the distribution. `upper` numeric or vector. The upper bound(s) B of the support [A, B] of the distribution. `moments` numeric vector giving the non standardized moments m₁, m₂, m₃, ..., sorted by their degree. This vector should have at least two entries. It is also possible to enter a matrix, where every row contains the moments m₁, m₂, m₃, .... `eps` numeric value. Some inequalities are of the form `... > 0`. For numerical reasons it is better to test for `... > eps` where `eps` is a small number.

## Value

Character vector giving the results of the test. Possible values are "not unimodal", "not existant", "2-b-unimodal", "4-b-unimodal" or NA_character_ .

## References

\insertRef

TeuscherGuiard1994momcalc

\insertRef

JohnsonRogers1951momcalc

\insertRef

SimpsonWelch1960momcalc

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28``` ```### mixture of two normal distributions ### d <- list(list("norm", mean = 3), list("norm", mean = 13)) is.unimodal(0, 20, mmix(1:4, 0, 20, distrib = d, weights = c(0.3, 0.7))) d[]["mean"] <- 8 is.unimodal(0, 20, mmix(1:4, 0, 20, distrib = d, weights = c(0.3, 0.7))) ### very close to unimodal ### d <- list(list(spec = "unif", min = 3, max = 4), list(spec = "lnorm", meanlog = 4)) w <- c(10,1) curve(dmix(lower = 0, upper = 10, weights = w, distrib = d)(x), 0, 11) is.unimodal(0, 10, mmix(1:4, 0, 10, weights = w, distrib = d)) ### not unimodal at all ### d <- list(list(spec = "exp"), list(spec = "unif", min = 0, max = 1), list(spec = "unif", min = 5, max = 6), list(spec = "unif", min = 0, max = 10)) curve(dmix(lower = 0, upper = 10, distrib = d)(x), -1, 11) is.unimodal(0,10, mmix(1:4, 0, 10, distrib = d)) ```

CharlotteJana/momcalc documentation built on Oct. 17, 2019, 7:21 a.m.