View source: R/func_size_bayes.R
| func_size_bayes | R Documentation |
Computes a Bayesian posterior distribution for the functional size of a lineup using a Beta-Binomial conjugate model for the suspect-selection rate.
func_size_bayes(
lineup_vec,
target_pos,
alpha = 0.5,
S = 10000,
credible_mass = 0.95,
threshold = NULL
)
lineup_vec |
A numeric vector of lineup choices. |
target_pos |
A scalar; the position of the suspect in the lineup. |
alpha |
Dirichlet concentration (prior strength). A positive scalar.
Named shortcuts: |
S |
Number of posterior draws. Default 10000. |
credible_mass |
Width of the equal-tailed credible interval. Default 0.95. |
threshold |
Optional numeric. If supplied, reports |
Functional size F = N / n_s is the reciprocal of the suspect-selection rate
p = n_s / N. The Beta-Binomial conjugate model gives:
p \mid \mathbf{n} \sim \mathrm{Beta}(n_s + \alpha,\; N - n_s + \alpha)
Posterior draws of p^{(s)} are transformed via F^{(s)} = 1/p^{(s)}.
The default Jeffreys prior (\alpha = 0.5) is recommended. The posterior
gives direct probability statements such as P(F < k \mid \mathbf{n}),
where k is the nominal lineup size.
The posterior mean of a reciprocal is computed exactly, not from the draws:
with a = n_s + \alpha and b = N - n_s + \alpha,
E[F \mid \mathbf{n}] = (a + b - 1)/(a - 1) when a > 1. When
a \le 1 (for example, no suspect choices under the Jeffreys prior) the
mean is infinite, and the Monte Carlo average of the draws would not settle
on any value as S grew. Report the median and interval instead.
An object of class "func_size_bayes" containing:
Numeric vector of length S: posterior draws of functional size.
Posterior point estimates. The
mean is exact, and is Inf when it does not exist (see Details).
Named two-element vector (lower, upper).
Input metadata.
Threshold and probabilities (or NULL).
Tredoux, C. G. (1998). Statistical inference on measures of lineup fairness. Law and Human Behavior, 22(2), 217-237.
func_size, esize_T_bayes
set.seed(1)
lineup_vec <- round(runif(100, 1, 6))
res <- func_size_bayes(lineup_vec, target_pos = 3)
print(res)
plot(res)
# Threshold: P(F < 6 | data)
res_t <- func_size_bayes(lineup_vec, target_pos = 3, threshold = 6)
print(res_t)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.