beta.posterior {streamDAG}R Documentation

Posterior Beta and Inverse-beta summaries

Description

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.

Usage


beta.posterior(p.prior, dat, length = NULL, w = 0.5)

Arguments

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: \theta_k \sim BETA(\alpha, \beta = t \alpha), where \frac{1}{1+t} = p_{prior}. This results in: E(\theta_k) = p_{prior}.

dat

An n \times s matrix of binary outcomes, where n is the number of observations (e.g., stream observations over time) and s is the number experimental units observed, (e.g., stream segments).

length

An optional n \times 1 vector containing stream segement lengths to allow calculation of mean stream Bernoulli stream length and mean communication distance.

w

Weight for the prior distribution compared to the actual data (generally a proportion).

Details

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).

Value

Returns a list with components:

alpha

The \alpha shape parameters for the beta and inverse beta posteriors.

beta

The \beta shape parameters for the beta and inverse beta posteriors.

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 is supplied, the mean communication distances of the network.

Length

If length is supplied, the mean stream length of the network.

x

The observed number of Bernoulli successes over n trials observed in dat.

Author(s)

Ken Aho

See Also

dinvbeta.


[Package streamDAG version 1.5 Index]