dip {diptest}R Documentation

Compute Hartigan's Dip Test Statistic for Unimodality

Description

Computes Hartigan's dip test statistic for testing unimodality, and additionally the modal interval.

Usage

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

Arguments

x numeric; the data.
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

dip the dip statistic
xl lower end of modal interval
xu upper end of modal interval


...
...

Note

For n <= 3 where n <- length(x), the dip statistic is always zero, i.e., there's no possible dip test.

Author(s)

Martin Maechler maechler@stat.math.ethz.ch, based on earlier code from Dario Ringach dario@wotan.cns.nyu.edu

References

P. M. Hartigan (1985) Computation of the Dip Statistic to Test for Unimodality; Applied Statistics 34, 320–325.

J. A. Hartigan and P. M. Hartigan (1985) The Dip Test of Unimodality; Annals of Statistics 13, 70–84.

See Also

isoreg for isotonic regression.

Examples

data(statfaculty)
plot(density(statfaculty))
dip(statfaculty)

str(dip(statfaculty, full = TRUE, debug = TRUE))

data(faithful)
fE <- faithful$eruptions
plot(density(fE))
str(dip(fE, full = TRUE, debug = TRUE))

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

[Package Contents]