bf_binom {multinomineq} | R Documentation |
Bayes Factor for Linear Inequality Constraints
Description
Computes the Bayes factor for product-binomial/-multinomial models with
linear order-constraints (specified via: A*x <= b
or the convex hull V
).
Usage
bf_binom(k, n, A, b, V, map, prior = c(1, 1), log = FALSE, ...)
bf_multinom(
k,
options,
A,
b,
V,
prior = rep(1, sum(options)),
log = FALSE,
...
)
Arguments
k |
vector of observed response frequencies. |
n |
the number of choices per item type.
If |
A |
a matrix with one row for each linear inequality constraint and one
column for each of the free parameters. The parameter space is defined
as all probabilities |
b |
a vector of the same length as the number of rows of |
V |
a matrix of vertices (one per row) that define the polytope of
admissible parameters as the convex hull over these points
(if provided, |
map |
optional: numeric vector of the same length as |
prior |
a vector with two positive numbers defining the shape parameters of the beta prior distributions for each binomial rate parameter. |
log |
whether to return the log-Bayes factor instead of the Bayes factor |
... |
further arguments passed to |
options |
number of observable categories/probabilities for each item
type/multinomial distribution, e.g., |
Details
For more control, use count_binom
to specifiy how many samples
should be drawn from the prior and posterior, respectively. This is especially
recommended if the same prior distribution (and thus the same prior probability/integral)
is used for computing BFs for multiple data sets that differ only in the
observed frequencies k
and the sample size n
.
In this case, the prior probability/proportion of the parameter space in line
with the inequality constraints can be computed once with high precision
(or even analytically), and only the posterior probability/proportion needs
to be estimated separately for each unique vector k
.
Value
a matrix with two columns (Bayes factor and SE of approximation) and three rows:
-
`bf_0u`
: constrained vs. unconstrained (saturated) model -
`bf_u0`
: unconstrained vs. constrained model -
`bf_00'`
: constrained vs. complement of inequality-constrained model (e.g., pi>.2 becomes pi<=.2; this assumes identical equality constraints for both models)
References
Karabatsos, G. (2005). The exchangeable multinomial model as an approach to testing deterministic axioms of choice and measurement. Journal of Mathematical Psychology, 49(1), 51-69. doi:10.1016/j.jmp.2004.11.001
Regenwetter, M., Davis-Stober, C. P., Lim, S. H., Guo, Y., Popova, A., Zwilling, C., … Messner, W. (2014). QTest: Quantitative testing of theories of binary choice. Decision, 1(1), 2-34. doi:10.1037/dec0000007
See Also
count_binom
and count_multinom
for
for more control on the number of prior/posterior samples and
bf_nonlinear
for nonlinear order constraints.
Examples
k <- c(0, 3, 2, 5, 3, 7)
n <- rep(10, 6)
# linear order constraints:
# p1 <p2 <p3 <p4 <p5 <p6 <.50
A <- matrix(
c(
1, -1, 0, 0, 0, 0,
0, 1, -1, 0, 0, 0,
0, 0, 1, -1, 0, 0,
0, 0, 0, 1, -1, 0,
0, 0, 0, 0, 1, -1,
0, 0, 0, 0, 0, 1
),
ncol = 6, byrow = TRUE
)
b <- c(0, 0, 0, 0, 0, .50)
# Bayes factor: unconstrained vs. constrained
bf_binom(k, n, A, b, prior = c(1, 1), M = 10000)
bf_binom(k, n, A, b, prior = c(1, 1), M = 2000, steps = c(2, 4, 5))
bf_binom(k, n, A, b, prior = c(1, 1), M = 1000, cmin = 200)