View source: R/posterior_predictive.R
ppp_binom | R Documentation |
Uses posterior samples to get posterior-predicted frequencies and compare the Pearson's X^2 statistic for (1) the observed frequencies vs. (2) the posterior-predicted frequencies.
ppp_binom(prob, k, n, by)
ppp_multinom(prob, k, options, drop_fixed = TRUE)
prob |
vector with probabilities or a matrix with one probability vector per row.
For |
k |
vector of observed response frequencies. |
n |
integer vector, specifying the number of trials for each binomial/multinomial distribution
Note that this is the |
by |
optional: a vector of the same length as |
options |
number of observable categories/probabilities for each item
type/multinomial distribution, e.g., |
drop_fixed |
whether the output matrix includes the last probability for each category (which is not a free parameter since probabilities must sum to one). |
Myung, J. I., Karabatsos, G., & Iverson, G. J. (2005). A Bayesian approach to testing decision making axioms. Journal of Mathematical Psychology, 49, 205-225. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jmp.2005.02.004")}
sampling_binom
/sampling_multinom
to get
posterior samples and rpbinom
/rpmultinom
to
get posterior-predictive samples.
# uniform samples: p<.10
prob <- matrix(runif(300 * 3, 0, .1), 300)
n <- rep(10, 3)
ppp_binom(prob, c(1, 2, 0), n) # ok
ppp_binom(prob, c(5, 4, 3), n) # misfit
# multinomial (ternary choice)
prob <- matrix(runif(300 * 2, 0, .05), 300)
ppp_multinom(prob, c(1, 0, 9), 3) # ok
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.