Learn R Programming

probhat (version 0.4.1)

73_mode_estimation: Mode Estimation

Description

Compute the mode or modes, from probability distributions.

Usage

ph.mode (sf, infv=FALSE, ..., level.names=FALSE, freq, n)
ph.modes (sf, infv=FALSE)

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

level.names

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.

n

Integer, the sample size. Ignored, unless both infv and freq are true.

Ignored.

Value

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

ph.modes returns a numeric vector.

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 {
prep.ph.data ()

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

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

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

Run the code above in your browser using DataLab