Normalizes the distribution so that the total mass equals 1.
Arguments
- d
A vector with length(qp)
elements representing
the unscaled density at each quadrature point.
- qp
Vector of equally spaced quadrature points.
Value
A vector of length(d)
elements with
the prior density estimate at each quadature point.
Examples
dscore:::normalize(c(5, 10, 5), qp = c(0, 1, 2))
#> [1] 0.25 0.50 0.25
sum(dscore:::normalize(rnorm(5), qp = 1:5))
#> [1] 1