View source: R/beta_posterior.R
beta.posterior | R Documentation |
Calculates summaries for beta and inverse-beta posteriors given prior probabilities for success, binary data and prior weight specification. Summaries include beta and inverse beta posterior means and variances and stream length and communication distance summaries given that stream length
is provided for intermittent stream segments.
beta.posterior(p.prior, dat, length = NULL, w = 0.5)
p.prior |
Prior probability for success for the beta prior. The beta prior for the probability of success (e.g., stream presence) for kth outcome (e.g., stream segment) is defined as: |
dat |
An |
length |
An optional |
w |
Weight for the prior distribution compared to the actual data (generally a proportion). |
As our Bayesian framework we assume a conjugate beta prior \theta_k \sim BETA(\alpha, \beta)
and binomial likelihood \boldsymbol{x}_k \mid \theta_k \sim BIN(n, \theta_k)
resulting in the posterior \theta_k \mid \boldsymbol{x}_k \sim BETA(\alpha + \sum \boldsymbol{x}_k, \beta + n - \sum \boldsymbol{x}_k)
.
Returns a list with components:
alpha |
The |
beta |
The |
mean |
The means of the beta posteriors. |
var |
The variances of the beta posteriors. |
mean.inv |
The means of the inverse-beta posteriors. |
var.inv |
The variances of the inverse-beta posteriors. |
Com.dist |
If |
Length |
If |
x |
The observed number of Bernoulli successes over n trials observed in |
Ken Aho
dinvbeta
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.