Created
December 14, 2018 15:57
-
-
Save ericnovik/e79fbcb4d085b3aa94ea9511af331b3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(manipulate) | |
manipulate({ | |
lambda <- seq(0, 5, length = 100) | |
prior <- dgamma(lambda, a, b) | |
post <- dgamma(lambda, a + sum(y), b + length(y)) | |
tibble(lambda, prior, post) %>% | |
ggplot(aes(lambda, prior)) + geom_line() + | |
geom_line(aes(y = post), color = "red") + | |
ylab("density") + | |
xlab(expression(lambda)) | |
}, | |
a = slider(1, 10, step = 1), | |
b = slider(1, 10, step = 1), | |
y = slider(1, 10, step = 1) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment