R/rposterior.R
wbinpost.RdSamples from the posterior distribution of the probability \(p\) of a binomial distribution. User-supplied weights are applied to each observation when constructing the log-likelihood.
wbinpost(n, prior, ds_bin)A numeric scalar. The size of posterior sample required.
A function to evaluate the prior, created by
set_bin_prior.
prior$prior must be "bin_beta".
A numeric list. Sufficient statistics for inference about the binomial probability \(p\). Contains
sf : a logical vector of success (TRUE) and failure
(FALSE) indicators.
w : a numeric vector of length length(sf) containing
the values by which to multiply the observations when constructing the
log-likelihood.
An object (list) of class "binpost" with components
bin_sim_vals: An n by 1 numeric matrix of values
simulated from the posterior for the binomial
probability \(p\)
bin_logf: A function returning the log-posterior for
\(p\).
bin_logf_args: A list of arguments to bin_logf.
For prior$prior == "bin_beta" the posterior for \(p\)
is a beta distribution so rbeta is used to
sample from the posterior.
set_bin_prior for setting a prior distribution
for the binomial probability \(p\).