Skip to contents

Initialize KK risk-difference IVWC inference and prepare matched/reservoir paired-binomial components used by InferenceIncidKKNewcombeRiskDiff.

Computes the compound risk-difference point estimate \(\hat\theta = w_1 \hat\theta_1 + w_2 \hat\theta_2\) on the risk-difference (probability) scale, where \(\hat\theta_1\) is the paired discordant-pair estimate from matched pairs and \(\hat\theta_2\) is the two-sample estimate from reservoir subjects (each with its Wald variance), combined by inverse-variance weighting \(w_j \propto 1/\widehat{\mathrm{Var}}(\hat\theta_j)\) (falls back to the single available component when one has zero subjects). Caches intermediate match/reservoir statistics for reuse by compute_asymp_confidence_interval() and compute_asymp_two_sided_pval().

Usage

KKNewcombeRiskDiffIVWCSource

Details

Implements a compound risk-difference estimator for KK designs. It pools a matched-pair estimate and a reservoir estimate by inverse-variance weighted combination (IVWC). Despite the class name, the components use Wald (large-sample) variances, not Newcombe's Wilson-score intervals.

The matched-pair component is the paired risk difference \(\hat\theta_1 = \hat p_{10} - \hat p_{01}\) over the \(m\) matched pairs, where \(\hat p_{10}\) and \(\hat p_{01}\) are the proportions of discordant pairs of each kind, with the Wald variance \(\hat V_1 = \{\hat p_{10} + \hat p_{01} - (\hat p_{10} - \hat p_{01})^2\} / m\). The reservoir component treats the unmatched subjects as two independent binomial samples: \(\hat\theta_2 = \hat p_T - \hat p_C\) with \(\hat V_2 = \hat p_T(1 - \hat p_T)/n_T + \hat p_C(1 - \hat p_C)/n_C\). These are the simple asymptotic variances of Newcombe (1998), not his Wilson-score (Method 10) intervals; whether to implement the real Newcombe/Wilson intervals for the components is open (see v1.0.6-TODO-228). The two estimates are combined by inverse-variance weighting, \(\hat\theta = w_1 \hat\theta_1 + w_2 \hat\theta_2\), \(w_j = (1/\hat V_j) / \sum_k (1/\hat V_k)\), with variance \(\hat V_1 \hat V_2 / (\hat V_1 + \hat V_2)\), the IVWC framework used throughout the package's KK inference classes; the asymptotic confidence interval and p-value are Wald z procedures from that combined variance. likelihood_tier = "none": this is a closed-form estimator, not a fitted likelihood model, so no likelihood-ratio or parametric-bootstrap methods are exposed. If a design has no matched pairs or no reservoir subjects, or one component has a zero or non-finite variance, the single usable component is used directly rather than combined.

References

Newcombe, R. G. (1998). Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods. Statistics in Medicine, 17(8), 873-890. doi:10.1002/(SICI)1097-0258(19980430)17:8<873::AID-SIM779>3.0.CO;2-I

Examples

# \donttest{
seq_des = DesignSeqOneByOneKK14$new(n = 10, response_type = 'incidence')
for (i in 1:10) {
  seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1), x2 = rnorm(1)))
}
seq_des$add_all_subject_responses(rbinom(10, 1, 0.5))
inf = InferenceIncidKKNewcombeRiskDiff$new(seq_des)
inf$compute_estimate()
#> [1] 0.5
# }