Learn R Programming

probhat (version 0.3.1)

76_mode_estimation: Mode Estimation

Description

Compute the mode or modes, from probability distributions.

Usage

ph.mode (sf, infv=FALSE, ..., name=FALSE, freq)
ph.modes (sf, infv=FALSE)

gmode (sf)

Arguments

sf

A suitable function object. For ph.mode, this is a univariate PMF or spline-based PDF. For ph.modes, a spline-based PDF only. Refer to the references and see also sections.

infv

Logical, if true, return the value of the PMF/PDF at the mode(s).

name

Logical, if false, return the category index, if true, return the category name. Ignored, except for categorical PMFs with infv=FALSE.

freq

Logical, if true, return frequencies. Ignored, except for PMFs with infv=TRUE. Default depends on the object. Refer to the corresponding constructors.

Ignored.

Value

ph.mode returns a single integer or numeric value. (Except for categorical PMFs with infv=FALSE and name=TRUE, which return a string).

ph.modes returns a numeric vector.

Details

gmode is a wrapper for ph.mode with name=TRUE.

References

Refer to the vignette for an overview, references and better examples.

See Also

Succinct Constructors Discrete Kernel Smoothing, Continuous Kernel Smoothing, Categorical Distributions, Empirical-Like Distributions

probmv, rng

ph.mean, moment quartiles, ntiles, ph.median, ph.quantile

Examples

Run this code
# NOT RUN {
ph.data.prep ()

gfh <- pmfuv.cat (crime.type, n.arrests)
cfh.nondefault <- pdfuv.cks (height, smoothness=0.5)

ph.mode (gfh)
ph.mode (gfh, TRUE)
ph.mode (gfh, TRUE, freq=TRUE)
ph.mode (gfh, category=TRUE)

gmode (gfh)

ph.mode (cfh.nondefault)
ph.modes (cfh.nondefault)
# }

Run the code above in your browser using DataLab