postprob | R Documentation |
Computes posterior model probabilities based on Bayes factors.
postprob(..., prior, include_unconstr = TRUE)
... |
one or more Bayes-factor objects for different models as returned
by the functions |
prior |
a vector of prior model probabilities (default: uniform). The
order must be identical to that of the Bayes factors supplied via
|
include_unconstr |
whether to include the unconstrained, encompassing model without inequality constraints (i.e., the saturated model). |
# data: binomial frequencies in 4 conditions n <- 100 k <- c(59, 54, 74) # Hypothesis 1: p1 < p2 < p3 A1 <- matrix(c( 1, -1, 0, 0, 1, -1 ), 2, 3, TRUE) b1 <- c(0, 0) # Hypothesis 2: p1 < p2 and p1 < p3 A2 <- matrix(c( 1, -1, 0, 1, 0, -1 ), 2, 3, TRUE) b2 <- c(0, 0) # get posterior probability for hypothesis bf1 <- bf_binom(k, n, A = A1, b = b1) bf2 <- bf_binom(k, n, A = A2, b = b2) postprob(bf1, bf2, prior = c(bf1 = 1 / 3, bf2 = 1 / 3, unconstr = 1 / 3) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.