Check if a function is a valid bounded probability density function (PDF)
Source:R/check.R
check_dprimary.Rd
This function tests whether a given function behaves like a valid PDF by checking if it integrates to approximately 1 over the specified range and if it takes the arguments min and max.
Usage
check_dprimary(dprimary, pwindow, dprimary_args = list(), tolerance = 0.001)
Arguments
- dprimary
Function to generate the probability density function (PDF) of primary event times. This function should take a value
x
and apwindow
parameter, and return a probability density. It should be normalized to integrate to 1 over [0, pwindow]. Defaults to a uniform distribution over [0, pwindow]. Users can provide custom functions or use helper functions likedexpgrowth
for an exponential growth distribution. Seeprimary_dists.R
for examples.- pwindow
Primary event window
- dprimary_args
List of additional arguments to be passed to dprimary. For example, when using
dexpgrowth
, you would passlist(min = 0, max = pwindow, r = 0.2)
to set the minimum, maximum, and rate parameters- tolerance
The tolerance for the integral to be considered close to 1
See also
Distribution checking functions
check_pdist()
,
check_truncation()