Learn R Programming

modeest (version 1.06)

dip: Compute Hartigan's DIP Test Statistic for Unimodality

Description

Computes Hartigan's DIP test statistic for testing unimodality, and additionally the modal interval. This function is taken from Martin Maechler's diptest package.

Usage

dip(x, 
    full.result = FALSE, 
    debug = FALSE)

Arguments

x
numeric. Vector of observations.
full.result
logical. If TRUE returns the full result list, see below.
debug
logical. If TRUE, some tracing information is printed (from the C routine).

Value

  • Depending on full.result either a number, the dip statistic, or a list with components
  • xthe sorted unname()d data.
  • nlength(x).
  • dipthe dip statistic
  • lo.hiindices into x for lower and higher end of modal interval
  • xl, xulower and upper end of modal interval
  • gcm, lcm(last used) indices for greatest convex minorant and the least concave majorant.
  • mn, mjindex vectors of length n for the GC minorant and the LC majorant respectively.

References

  • Hartigan J.A. and Hartigan P.M. (1985). The Dip Test of Unimodality.Ann. Statist.,13:70-84.
  • Hartigan P.M. (1985). Computation of the Dip Statistic to Test for Unimodality.Appl. Statist. (JRSS C),34:320-325.

See Also

isoreg for isotonic regression.

Examples

Run this code
data(precip)
plot(density(precip))
str(dip(precip, full = TRUE, debug = TRUE))

Run the code above in your browser using DataLab