Power for PPI++ paired test with binary outcomes
power_ppi_paired_binary.RdComputes power for a paired test when outcomes are binary and predictions are derived from a classifier with sensitivity and specificity. The paired differences \(D = Y^A - Y^B\) and prediction differences \(f^D = f^A - f^B\) are treated via a CLT approximation using population moments implied by a joint Bernoulli model with within-pair correlation.
Arguments
- delta
Effect size: mean difference \(E[Y^A - Y^B]\). If NULL, uses \(p_A - p_B\).
- N
Number of unlabeled pairs with predictions.
- n
Number of labeled pairs.
- alpha
Two-sided significance level (default 0.05).
- p_A
Marginal probability \(P(Y^A=1)\).
- p_B
Marginal probability \(P(Y^B=1)\).
- rho_within
Pearson correlation between \(Y^A\) and \(Y^B\).
- sens
Classifier sensitivity.
- spec
Classifier specificity.
Details
The joint probability \(P(Y^A=1, Y^B=1)\) is set to $$p_{11} = p_A p_B + \rho_{\text{within}} \sqrt{p_A(1-p_A)p_B(1-p_B)}$$ and clipped to the feasible range. Predictions are generated conditionally on \(Y\) with sensitivity/specificity, and population moments are computed by marginalizing over the joint distribution of \((Y^A, Y^B)\).