binom_bf_equality {multibridge}R Documentation

Computes Bayes Factors For Equality Constrained Binomial Parameters

Description

Computes Bayes factor for equality constrained binomial parameters. Null hypothesis H_0 states that binomial proportions are exactly equal or exactly equal and equal to p. Alternative hypothesis H_e states that binomial proportions are free to vary.

Usage

binom_bf_equality(x, n = NULL, a, b, p = NULL)

Arguments

x

a vector of counts of successes, or a two-dimensional table (or matrix) with 2 columns, giving the counts of successes and failures, respectively

n

numeric. Vector of counts of trials. Must be the same length as x. Ignored if x is a matrix or a table

a

numeric. Vector with alpha parameters. Must be the same length as x. Default sets all alpha parameters to 1

b

numeric. Vector with beta parameters. Must be the same length as x. Default sets all beta parameters to 1

p

numeric. Hypothesized probability of success. Must be greater than 0 and less than 1. Default sets all binomial proportions exactly equal without specifying a specific value.

Details

The model assumes that the data in x (i.e., x_1, ..., x_K) are the observations of K independent binomial experiments, based on n_1, ..., n_K observations. Hence, the underlying likelihood is the product of the k = 1, ..., K individual binomial functions:

(x_1, ... x_K) ~ \prod Binomial(N_k, \theta_k)

Furthermore, the model assigns a beta distribution as prior to each model parameter (i.e., underlying binomial proportions). That is:

\theta_k ~ Beta(\alpha_k, \beta_k)

Value

Returns a data.frame containing the Bayes factors LogBFe0, BFe0, and BF0e

Note

The following signs can be used to encode restricted hypotheses: "<" and ">" for inequality constraints, "=" for equality constraints, "," for free parameters, and "&" for independent hypotheses. The restricted hypothesis can either be a string or a character vector. For instance, the hypothesis c("theta1 < theta2, theta3") means

The hypothesis c("theta1 < theta2 = theta3 & theta4 > theta5") means that

References

Damien P, Walker SG (2001). “Sampling truncated normal, beta, and gamma densities.” Journal of Computational and Graphical Statistics, 10, 206–215.

Gronau QF, Sarafoglou A, Matzke D, Ly A, Boehm U, Marsman M, Leslie DS, Forster JJ, Wagenmakers E, Steingroever H (2017). “A tutorial on bridge sampling.” Journal of Mathematical Psychology, 81, 80–97.

Frühwirth-Schnatter S (2004). “Estimating marginal likelihoods for mixture and Markov switching models using bridge sampling techniques.” The Econometrics Journal, 7, 143–167.

Sarafoglou A, Haaf JM, Ly A, Gronau QF, Wagenmakers EJ, Marsman M (2021). “Evaluating Multinomial Order Restrictions with Bridge Sampling.” Psychological Methods.

See Also

Other functions to evaluate informed hypotheses: binom_bf_inequality(), binom_bf_informed(), mult_bf_equality(), mult_bf_inequality(), mult_bf_informed()

Examples

data(journals)
x <- journals$errors
n <- journals$nr_NHST
a <- rep(1, nrow(journals))
b <- rep(1, nrow(journals))
binom_bf_equality(x=x, n=n, a=a, b=b)

[Package multibridge version 1.2.0 Index]