Theory¶
Misclassification model¶
Let \(Y \in \{0, 1\}\) be the true label of an answer and \(J\) the judge's verdict, with sensitivity \(s_e = P(J=1 \mid Y=1)\) and specificity \(s_p = P(J=0 \mid Y=0)\). The judge's pass rate is
so the naive rate is biased by \(q - \theta = \theta(s_e - 1) + (1-\theta)(1-s_p)\). Solving for \(\theta\) gives the Rogan-Gladen estimator
which is consistent whenever \(s_e + s_p > 1\). Estimates outside [0, 1] are truncated.
Delta method¶
With independent estimates \(\hat q\) (from \(N\) evaluated answers), \(\hat s_e\) (from \(m_1\) truly passing audited answers) and \(\hat s_p\) (from \(m_0\) truly failing ones), the partial derivatives are \(\partial\theta/\partial q = 1/J\), \(\partial\theta/\partial s_e = -\theta/J\) and \(\partial\theta/\partial s_p = (1-\theta)/J\) with \(J = s_e + s_p - 1\). Hence
veracle estimates \(\operatorname{Var}(\hat s_e)\) with the Laplace-adjusted proportion \((x+1)/(m+2)\), which keeps it positive when the judge is perfect on the audit, and uses cluster-robust variances when clusters are given. Because \(\hat\theta\) is a ratio, its distribution has heavier tails than the normal; the delta interval is then slightly conservative, which simulations confirm.
Bootstrap¶
Each bootstrap draw resamples the evaluated answers (whole clusters if given) and, independently, the audit (by cluster, or parametrically within each true class), and recomputes \(\hat\theta\). Percentile intervals of a ratio can be slightly too narrow with small audits, so veracle uses the delta method by default and offers the bootstrap as a check. The percentile interval and one-sided bounds are taken from the draws. P-values for a threshold \(\tau\) use \((1 + \#\{\theta^\ast \le \tau\}) / (B + 1)\).
Audit planning¶
With a random audit of size \(m\), \(m_1 \approx m\theta\) and \(m_0 \approx m(1-\theta)\), giving
audit_size finds the smallest \(m\) for a target margin of error.
Prediction-powered correction¶
If the audit is a uniform random subsample of size \(n\) of the \(N\) evaluated answers, the estimator \(\hat\theta_\lambda = \lambda \bar J_N + \overline{(Y - \lambda J)}_n\) is unbiased for every \(\lambda\). Because the audit is part of the evaluation set, \(\operatorname{Cov}(\bar J_N, \bar J_n) = \sigma_J^2/N\), and
with \(c = \operatorname{Cov}(Y, J)\). The minimiser is \(\lambda^\ast = c / \sigma_J^2\), the regression coefficient of \(Y\) on \(J\), and the minimum variance is \(\sigma_Y^2(1 - \rho^2)/n + \rho^2\sigma_Y^2/N\).
Comparing two models¶
With a shared judge and equal error rates for both models, \(\theta_A - \theta_B = (q_A - q_B)/J\). The delta method gives
where \(\operatorname{Var}(\hat q_A - \hat q_B)\) uses paired differences when both models answered the same prompts.
Decisions¶
A pass verdict rejects \(H_0: \theta \le \tau\) at level \(\alpha\), and a
fail verdict rejects \(H_0: \theta \ge \tau\). The two are mutually
exclusive, so each type of wrong claim has probability at most \(\alpha\).
For several claims the p-values are adjusted with the Holm,
Bonferroni or Benjamini-Hochberg procedure.
Judge consistency¶
judge_consistency applies a chi-square test of homogeneity to the
sensitivities, and separately to the specificities, of the groups.