Description Usage Arguments Value Author(s) Examples
View source: R/bernoulli_beta_model.R
Runs a bayesian estimation of proportion using bernoulli distribution as likelihood and beta distribution as conjugate prior. Posterior distribution is beta distribution.
1 | bernoulli_beta_model(alpha, beta, success, total, sample_size = 1e+05)
|
alpha |
Parameter for prior distribution representing the number of success |
beta |
Parameter for prior distribution representing the number of fails Prior used is Beta(alpha + 1, beta + 1) |
success |
Number of success cases in your data |
total |
Total number of cases in your data |
sample_size |
Size of sample from posterior distribution |
Vector of samples from posterior distribution
Posterior distribution is Beta(alpha + 1 + success, beta + 1 + total - success)
Elio Bartoš
1 2 3 4 5 6 7 8 9 10 11 | # No prior information, prior is uniform
post = bernoulli_beta_model(0, 0, 20, 100)
# Prior succes rate is around 5% with estimation strenght as it was estimated on a sample of 100
post2 = bernoulli_beta_model(5, 95, 3, 50)
mean(post)
quantile(post, probs = c(0.05, 0.95)) # 90% highest density posterior interval
mean(post2)
quantile(post2, probs = c(0.05, 0.95))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.