
Newcombe Risk-Difference Inference for Binary Responses
Source:R/inference_incidence_newcombe_univ.R
InferenceIncidNewcombeRiskDiff.RdFits the Newcombe hybrid score method (Method 10) for the risk difference in a two-arm binary trial. This method constructs a confidence interval for the difference between two independent proportions by combining Wilson score intervals for each group.
This class is unadjusted and assumes independent samples (e.g. from a
Bernoulli design). It ignores any matched-pair structure if present; for
matched data, use InferenceIncidKKNewcombeRiskDiff. The point
estimate is the plain risk difference \(\hat p_T - \hat p_C\). The
confidence interval (newcombe_independent_ci_cpp) is Newcombe's
"Method 10" hybrid score interval: separate Wilson score intervals
\([\ell_T, u_T]\) and \([\ell_C, u_C]\) are computed for each arm's
proportion individually, then combined into a difference interval via
\([\hat p_T - \hat p_C - \sqrt{(\hat p_T - \ell_T)^2 + (u_C - \hat
p_C)^2},\ \hat p_T - \hat p_C + \sqrt{(u_T - \hat p_T)^2 + (\hat p_C -
\ell_C)^2}]\) — this avoids the boundary/coverage problems of the naive
Wald interval on a risk difference while remaining closed-form (no
iterative score-test inversion, unlike the Miettinen-Nurminen method in
InferenceIncidMiettinenNurminenRiskDiff).
The two-sided p-value has no closed form here: it is obtained by
numerically inverting the confidence interval (bisection via
stats::uniroot) to find the significance level at which delta
falls exactly on the interval boundary.
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 , for "Method 10", the hybrid Wilson-score interval used here.
Super class
Inference -> InferenceIncidNewcombeRiskDiff
Methods
Public methods
+ inherited public methods from Inference
Inference$capabilities()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$is_nonestimable()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceIncidNewcombeRiskDiff$new()
Uses the shared randomization two-sided p-value contract; see
InferenceRand.
Initialize a Newcombe risk-difference inference object for a completed design with an uncensored incidence response.
Usage
InferenceIncidNewcombeRiskDiff$new(
des_obj,
model_formula = NULL,
verbose = FALSE
)Arguments
des_objA completed
DesignSeqOneByOneobject with an incidence response.model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.verboseWhether to print progress messages.
InferenceIncidNewcombeRiskDiff$compute_estimate()
Computes the observed (unadjusted) risk-difference estimate \(\hat p_T - \hat p_C\) (see class documentation for the full Newcombe interval method).
InferenceIncidNewcombeRiskDiff$compute_estimate_with_bootstrap_weights()
Recomputes the risk-difference estimate under subject/block
bootstrap weights: the weighted event proportions \(\hat p_T^w =
\sum_i r_i y_i \mathbb{1}[w_i=1] / \sum_i r_i \mathbb{1}[w_i=1]\) (and
analogously for control), differenced. Used by the Bayesian bootstrap
and related weighted-resampling machinery; see
InferenceBayesianBootstrap.
Always leaves the standard error and degrees of freedom unavailable
(NA) regardless of estimate_only — the Newcombe interval
method has no separate variance quantity to compute on this path.
InferenceIncidNewcombeRiskDiff$compute_asymp_confidence_interval()
Computes a \(1-\alpha\) Newcombe hybrid Wilson-score
confidence interval for the risk difference (see class documentation
for the full formula), via newcombe_independent_ci_cpp.
InferenceIncidNewcombeRiskDiff$compute_asymp_two_sided_pval()
Computes a two-sided p-value testing \(H_0: p_T - p_C =
\code{delta}\) by numerically finding (stats::uniroot) the
significance level \(\alpha\) at which delta falls exactly on
the boundary of the Newcombe confidence interval (see class
documentation) — there is no closed-form p-value for this method.
Returns \(1\) if no root is found in \((10^{-10}, 1-10^{-10})\)
(interpreted as delta being far inside the interval at every
plausible \(\alpha\)).
Examples
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$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)))
}
seq_des$add_all_subject_responses(rbinom(10, 1, 0.5))
inf = InferenceIncidNewcombeRiskDiff$new(seq_des)
inf$compute_estimate()
#> [1] 0.8
# }