Description Usage Arguments Details Value Author(s) Examples
View source: R/savage_dickey.R
Creates plot of prior and posterior distributions and calculates the Bayes factor at the point of interest (Q).
1 2 3 4 5 6 7 8 9 | savage_dickey(
post,
prior,
Q,
xlab = "Parameter values",
ylab = "Density",
plot = TRUE,
print_plot = FALSE
)
|
post |
Samples from posterior distribution (Numeric) |
prior |
Samples from prior distribution (Numeric) |
Q |
Point on x-axis for calculating Bayes factor. |
xlab |
Label for x-axis |
ylab |
Label for y-axis |
plot |
Create density plot (Logical) |
print_plot |
(Logical) |
Bayes factors are calculated using the polspline package.
BF10 <- dlogspline(Q, logspline(post)) / dlogspline(Q,logspline(prior))
BF01 <- dlogspline(Q, logspline(prior)) / dlogspline(Q,logspline(post))
List with ggplot2 object (optional), BF10 and BF01, Maximum a posteriori and priori at point Q
Benjamin Hugh Zachariae
Ludvig Renbo Olsen
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.