Learn R Programming

distr6 (version 1.3.1)

pdf: Probability Density/Mass Function

Description

Returns the probability density/mass function for continuous/discrete (or mixture) distributions evaluated at a given point.

Usage

pdf(object, x1, ..., log = FALSE, simplify = TRUE)

Arguments

object

Distribution.

x1

vector of numerics to evaluate function at.

...

additional arguments.

log

logical; if TRUE, probabilities p are given as log(p).

simplify

if TRUE (default) returns results in simplest form (vector or data.table) otherwise as data.table.

Value

Probability density function evaluated at given points as either a numeric if simplify is TRUE or as a data.table.

R6 Usage

$pdf(x1, ..., log = FALSE, simplify = TRUE)

Details

For discrete distributions the probability mass function (pmf) is returned, defined as $$p_X(x) = P(X = x)$$ for continuous distributions the probability density function (pdf), \(f_X\), is returned $$f_X(x) = P(x < X \le x + dx)$$ for some infinitesimally small \(dx\).

If available a pdf will be returned without warning using an analytic expression. Otherwise, if the distribution has not been decorated with FunctionImputation, NULL is returned. To impute the pdf, use decorate(distribution, FunctionImputation), this will provide a numeric calculation for the pdf with warning.

Additional named arguments can be passed, which are required for composite distributions such as ProductDistribution and ArrayDistribution.

See Also

cdf, quantile, rand for other statistical functions. FunctionImputation, decorate for imputing missing functions.