B1prop: Bayesian analysis of the binomial parameter for one sample.
Description
This function computes the posterior distribution of the binomial
probability \(\pi\) when given the number of ``successes'' and the sample
size, as well as one of a choice of priors. A plot of the posterior
distribution is produced with the 95% credible interval of \(\pi\).
Usage
B1prop(s, n, p = 0.5, alpha = 0.05, prior = c("uniform", "near_0.5",
"not_near_0.5", "near_0", "near_1", "custom"), params = NULL)
Arguments
s
the number of sampling units with the feature
n
the number of sampling units examined
p
an optional hypothesized probability
alpha
1 - alpha is the desired level of credibility of a credible interval
prior
one of: "uniform", "near_0.5", "not_near_0.5", "near_0", "near_1",
"custom", which are all beta distributions with appropriate parameter
values. Note that if prior="custom" the following argument has to
be supplied:
params
a vector with the a and b parameters of the custom beta prior
Value
the posterior probability
References
van Hulst, R. 2018. Evaluating Scientific Evidence. ms.