Description Usage Arguments Value References Examples

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.

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)
``` |

`lower` |
numeric or vector. The lower bound(s) A of the support |

`upper` |
numeric or vector. The upper bound(s) B of the support |

`moments` |
numeric vector giving the non standardized moments |

`eps` |
numeric value. Some inequalities are of the form |

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

TeuscherGuiard1994momcalc

\insertRefJohnsonRogers1951momcalc

\insertRefSimpsonWelch1960momcalc

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[[2]]["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))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.