Skip to contents

rho_Z(z) = integral rho_X(x) rho_Y(z - x) dx, trapezoid on the x grid with rho_Y linearly interpolated and zero outside its grid.

Usage

SumDens(grid_x, density_x, grid_y, density_y, z)

Arguments

grid_x, density_x

the density of X.

grid_y, density_y

the density of Y.

z

evaluation point.

Value

list(z, density).

References

Morin, D. J. (2016). Probability: For the Enthusiastic Beginner. Createspace. Eq (6.65).

Examples

g <- seq(-8, 8, length.out = 1601); SumDens(g, stats::dnorm(g), g, stats::dnorm(g), 1)$density
#> [1] 0.2196956