Skip to contents

Performs exact matched-pair inference for binary (incidence) outcomes using only discordant matched pairs — pairs where the treated and control member's outcomes differ — the same reduction classical McNemar's test makes. Writing \(d_+\) for the count of discordant pairs where the treated subject had the event and the control did not, and \(d_-\) for the reverse, the point estimate is the Haldane-Anscombe continuity-corrected log odds ratio \(\log\left((d_+ + 0.5)/(d_- + 0.5)\right)\); the confidence interval inverts the exact (Clopper-Pearson) binomial confidence interval for \(d_+ / (d_+ + d_-)\) against \(1/2\) (via stats::binom.test) onto the log-odds scale; and the two-sided p-value is an exact binomial test of \(d_+\) vs. \(d_-\) (via zhang_exact_binom_pval_cpp) against a null log odds ratio. This class is available for DesignFixedBinaryMatch and KK matching-on-the-fly designs. For KK designs, only the matched-pair data are used and the reservoir is ignored. If there are no matched pairs, or no discordant pairs, the relevant quantities are reported as non-estimable rather than as NaN/Inf.

Super class

Inference -> InferenceIncidExactBinomial

Methods

+ inherited public methods from Inference


InferenceIncidExactBinomial$new()

Usage

InferenceIncidExactBinomial$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE,
  smart_cold_start_default = NULL
)

Arguments

des_obj

A completed Design object whose entire n subjects are assigned and response y is recorded within.

model_formula

Optional 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.

verbose

Whether to print progress messages.

smart_cold_start_default

Whether to use smart cold start values by default for likelihood-based models. Explicit starts always override this object-level policy. NULL (default) consults the global cold-start dispatch policy.


InferenceIncidExactBinomial$compute_estimate()

Usage

InferenceIncidExactBinomial$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip variance component calculations.


InferenceIncidExactBinomial$clone()

The objects of this class are cloneable with this method.

Usage

InferenceIncidExactBinomial$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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 = InferenceIncidExactBinomial$new(seq_des)
inf$compute_estimate()
#> [1] 0
# }