Trapezoid integration on a 513-point refinement of [a, b]. The
supplied density must integrate to within 5 percent of 1 over the
whole grid, which catches an unnormalised input.
Usage
DensProb(grid, density, a, b)
Arguments
- grid
strictly increasing abscissae, length >= 2.
- density
non-negative density values on grid.
- a, b
interval bounds, grid[1] <= a <= b <= grid[length(grid)].
Value
list(probability, a, b).
References
Morin, D. J. (2016). Probability: For the Enthusiastic
Beginner. Createspace. Eq (4.2).
Examples
g <- seq(-6, 6, length.out = 1201); DensProb(g, stats::dnorm(g), -1, 1)$probability
#> [1] 0.6826848