Description Usage Arguments Value Examples
Numerically integrates a PDF to get a CDF using the trapezoid rule.
This function is designed for use on the output of kernel density
estimators like base::density
or KernSmooth::bkde
.
1 |
p |
The PDF to integrate, either as a vector of probabilities or as a list with elements named 'x' and 'y'. Probabilities (p or p$y) should be non-negative; negative values will be silently set to 0. |
x |
The x-coordinates of the PDF. If p is an atomic vector and x is not given, x is assumed to be 1:length(p). Values of x must be strictly increasing, but need not be uniformly spaced. |
normalize |
Logical; if true, normalizes the PDF to integrate exactly to 1. (PDF estimates produced by base::density often need this correction.) |
expand |
Logical; if true, returns a CDF two elements longer than the input PDF that includes the two fencepost values added onto the ends for integration. If normalize=TRUE, the fenceposts will be identically 0 and 1. |
A list with components 'x' and 'y'.
x: vector of x coordinates for the distribution.
y: vector of probabilities that the distribution takes on a value less than or equal to the corresponding x.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.