BF_01 = p(theta_0 | y) / p(theta_0), the posterior density at the
null over the prior density there. The posterior density comes from
a Gaussian KDE with Silverman's bandwidth unless one is supplied.
Usage
morie_bayes_factor_savage_dickey(samples, prior, theta0 = 0, bandwidth = NULL)
Arguments
- samples
Posterior draws, at least 10.
- prior
Prior density function, or its value at theta0 (> 0).
- theta0
The null value.
- bandwidth
Optional KDE bandwidth override (> 0).
Value
List with estimate (BF_01), bf10,
posterior_density_at_null, prior_density_at_null, bandwidth,
n, method.
Examples
d <- seq(-1, 1, length.out = 2001)
round(morie_bayes_factor_savage_dickey(d, 1 / 6, 0)$estimate, 3)
#> [1] 2.999