Transform Bayes Factors to Posterior Model Probabilities
Transform Bayes Factors to Posterior Model Probabilities
Computes posterior model probabilities based on Bayes factors.
postprob(..., prior, include_unconstr =TRUE)
Arguments
...: one or more Bayes-factor objects for different models as returned by the functions bf_binom, bf_multinom and count_to_bf (i.e., a 3x4 matrix containing a row "bf0u" and a column "bf"). Note that the Bayes factors must have been computed for the same data and using the same prior (this is not checked internally).
prior: a vector of prior model probabilities (default: uniform). The order must be identical to that of the Bayes factors supplied via .... If include_unconstr=TRUE, the unconstrained model is automatically added to the list of models (at the last position).
include_unconstr: whether to include the unconstrained, encompassing model without inequality constraints (i.e., the saturated model).
Examples
# data: binomial frequencies in 4 conditionsn <-100k <- c(59,54,74)# Hypothesis 1: p1 < p2 < p3A1 <- matrix(c(1,-1,0,0,1,-1),2,3,TRUE)b1 <- c(0,0)# Hypothesis 2: p1 < p2 and p1 < p3A2 <- matrix(c(1,-1,0,1,0,-1),2,3,TRUE)b2 <- c(0,0)# get posterior probability for hypothesisbf1 <- 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))