Hard-coded functions, representing (runtime) function objects.
DO NOT CALL THESE FUNCTIONS. CALL A CONSTRUCTOR, WHICH SHOULD RETURN A FUNCTION OBJECT.
#PMF/PDF and CDF
#(all distributions, except the exceptions below)
fobj.f (x, y)
fobj.F (x, y)#Categorical PMF
fobj.gf (a, b)
#Trivariate Normal PDF
fobj.f3 (x, y, z)
#Dirichlet PDF
fobj.wf (x, y, z = 1 - x - y, …, log=FALSE)
#ECDF
fobj.Fh (x, y)
Vectors giving the evaluation bins/points. In discrete distributions, they should be integers. In continuous distributions they should be numerics. Currently, missing values, non-finite values and zero-length vectors are not allowed.
Integer or character vectors, giving the evaluation bins. (Same as x and y above, except that strings are allowed).
Logical, if true, return log-transformed densities.
Ignored.
PMFs return a numeric vector, giving mass. P (X = x, Y = y)
PDFs return a numeric vector, giving density.
CDFs return a numeric vector, giving cumulative probability. P (X <= x, Y <= y)
DO NO CALL THESE FUNCTIONS. CALL A CONSTRUCTOR, WHICH SHOULD RETURN A FUNCTION OBJECT.
Uniform and binomial distributions allow evaluation values outside the supported region. (PMFs/PDFs return zero mass/density, and CDFs return the corresponding values).
Poisson evaluation values need to be non-negative.
Categorical string evaluation values need to match group names, taken from the parameter matrix.
Categorical integer evaluation values, need to have: x in [1, ngx], where ngx is the number of x groups (and rows of the parameter matrix). y in [1, ngy], where ngy is the number of y groups (and columns of the parameter matrix).
In Dirichlet distributions, z is optional. And the three variables should be in the interval (0, 1) and sum to one.
Note that kbvpdf objects (often labelled fh), can't be evaluated. (However, the bvmat function can be used to compute density matrices).
Also note that the help pages, linked to in the see also section, have better examples.
Refer to the vignette for an overview, references, theoretical background and better examples.
Uniform For uniform distributions.
Binomial, Poisson and Categorical For other probability distributions of discrete random variables.
Normal, Bimodal, Dirichlet and Nonparametric For other probability distributions of continuous random variables.
# NOT RUN {
f <- nbvpdf ()
x <- -3:3
y <- 0
density <- f (x, y)
cbind (x, y, density)
# }
Run the code above in your browser using DataLab