Learn R Programming

probhat (version 0.4.1)

80_runtime_function_objects: Runtime Function Objects

Description

Hard-coded functions, representing (runtime) function objects.

DO NOT CALL THESE FUNCTIONS. CALL A CONSTRUCTOR, WHICH SHOULD RETURN A FUNCTION OBJECT. THE RESULTING FUNCTION OBJECTS SHOULD HAVE THE SAME ARGUMENTS AS BELOW.

Usage

#categorical models
#(CAT/gMIX)
ph.gfh.rtf (g, …, freq=FALSE, n)      #PMF
ph.gFh.rtf (g, …, freq=FALSE, n)      #CDF
ph.gFht.rtf (p, …, level.names=FALSE) #QF

#other discrete models #(DKS) ph.dfh.rtf (x, …, freq=FALSE, n) #PMF ph.dFh.rtf (x, …, freq=FALSE, n) #CDF ph.dFht.rtf (p) #QF

#univariate continuous models #(CKS/EL/xMIX, UV/C) ph.cfh.rtf (x) #PDF ph.cFh.rtf (x) #CDF ph.cFht.rtf (p) #QF

#multivariate continuous models #(CKS, MV/MVC) ph.cfh.rtf.mv (x) #PDF ph.cFh.rtf.mv (x) #CDF

#chained quantile functions ph.chFht.rtf (p)

Arguments

g, x

IN (DKS) MODELS: An integer vector, of quantiles. IN (CAT/gMIX) MODELS: An integer/factor/character vector, of quantiles. Integers represent category indices. Characters and formatted factors represent category names. IN (CKS/EL/xMIX, UV/C) MODELS: A numeric vector, of quantiles. IN (CKS, MV/MVC) MODELS: A numeric vector or matrix, of quantiles. Standard numeric vectors are rbind-ed into single-row matrices. Each row represents one evaluation point, and each column represents one variable.

p

A numeric vector of probabilities, between zero and one. Except in chained quantile functions, where p should be a numeric vector or matrix. Standard numeric vectors are rbind-ed into single-row matrices.

freq

Logical, if true, return frequencies rather than probabilities.

level.names

Logical, if true, return category names rather than category indices. Refer to the value section.

n

Sample size. Ignored, unless freq is true.

Ignored.

Value

By default: PMFs return a numeric vector, giving probability mass. PDFs return a numeric vector, giving probability density. CDFs return a numeric vector, giving cumulative probability (from zero to one). Discrete quantile functions, return an integer vector of quantiles. Continuous quantile functions, return a numeric vector of quantiles.

In the discrete case, setting freq=TRUE, scales the values to match the n, the sample size. By default, n is the number of observation used, or the sum of the unscaled weights/frequencies.

In categorical quantile functions, setting level.names=TRUE, returns a character vector of levels names.

Chained quantile functions, return a numeric matrix of multivariate quantiles.

Details

DO NO CALL THESE FUNCTIONS. CALL A CONSTRUCTOR, WHICH SHOULD RETURN A FUNCTION OBJECT.

If x or p are matrices, then the order of the columns should be the same as the order of the random variables in the model.

Also, if a bounded interval was used, then the quantiles need to be within the limits.

References

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

See Also

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

Conditional Distributions with Mixed Input Types