Skip to contents

Unadjusted blocked-design incidence inference using the simple mean-difference point estimate with a randomization-based standard error.

Legacy inference class. This class is retained for backwards compatibility and is not comprehensively tested by the package comprehensive-test harness.

Internally, this class recodes treatment assignments to \(w_i \in \{-1, +1\}\) (the package-wide convention is \(\{0,1\}\); see Design). For a balanced design the treatment-effect estimator is \(\hat\tau = (2/n)\,\mathbf{y}'\mathbf{w}\), and since \(E_w[\mathbf{y}'\mathbf{w}] = 0\) for any balanced randomization the standard error is $$SE(\hat\tau) = \frac{2}{n}\sqrt{\frac{\sum_k (\mathbf{y}'\mathbf{w}_k)^2}{K}}$$ where \(K\) draws \(\mathbf{w}_1,\ldots,\mathbf{w}_K\) come from the design's reference distribution. Centering at the known zero mean (rather than the sample mean) makes the denominator \(K\) rather than \(K-1\).

For blocking designs the expectation is evaluated exactly: $$SE(\hat\tau) = \frac{2}{n}\sqrt{\sum_b \frac{n_{1b}\,n_{0b}}{n_B - 1}}$$ where \(n_{1b}, n_{0b}\) are the numbers of positive and negative responses in block \(b\) and \(n_B\) is the (common) block size. This equals \(2\sqrt{V_{\rm CMH}}\) where \(V_{\rm CMH}\) is the CMH variance from Azriel et al. (2026), Equation 3.

For non-blocking designs, the "balanced design" precondition above requires the observed treatment allocation to be exactly balanced (\(n_T = n_C\)), not merely drawn from a \(prob\_T = 0.5\) mechanism – e.g. plain Bernoulli randomization has \(prob\_T = 0.5\) but does not guarantee an exactly balanced realized allocation. A warning (not an error) is issued once, the first time the standard error is actually computed (i.e. on the first confidence-interval / p-value / standard-error request, not at construction or for estimate-only use), when this is violated – erroring would make this class unusable with Bernoulli-style non-blocking designs entirely; the warning tells the caller the reported standard error may be miscalibrated.

Super class

Inference -> InferenceIncidCMH

Methods

+ inherited public methods from Inference


InferenceIncidCMH$compute_asymp_confidence_interval()

Uses the randomization-CI layer's two-sided p-value contract (InferenceRandCI's version, not InferenceRand's): for incidence responses this dispatches to the Zhang exact randomization test where applicable rather than refusing outright, matching this class's pre-migration old-ladder behavior (it inherited from InferenceAllSimpleAverageDiff, whose own pin was already corrected to InferenceRandCI – see that file's identical rationale). This class independently composes the same components rather than truly inheriting InferenceAllSimpleAverageDiff, so it had its own stale copy of the old InferenceRand pin, which silently regressed Zhang dispatch for the non-blocking balanced-design path – found via test-incid-cmh-extended-robins-migration-golden.R's randomization_pval case going from `"ok"` to `"unsupported"`.

Wald confidence interval for the balanced-design/CMH risk-difference estimate \(\hat\tau\), using the randomization-based (blocking-design: exact CMH variance formula; non-blocking design: Monte Carlo over se_est_num_vectors design draws) standard error documented in the class @details. See InferenceAsymp for the shared Wald contract.

Usage

InferenceIncidCMH$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

The confidence level in the computed confidence interval is 1 - alpha. The default is 0.05.

Returns

A length-2 numeric vector c(lower, upper) on the risk-difference scale.


InferenceIncidCMH$compute_asymp_two_sided_pval()

Two-sided Wald p-value for \(H_0: \tau = \code{delta}\) vs. \(H_1: \tau \neq \code{delta}\), using the same randomization-based standard error as compute_asymp_confidence_interval().

Usage

InferenceIncidCMH$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

The null value of \(\tau\) to test against; 0 (the default) tests for any treatment effect at all.

Returns

Numeric scalar p-value in \([0, 1]\).


InferenceIncidCMH$new()

Initialize Cochran-Mantel-Haenszel incidence inference, validate the stratified binary-response design, and prepare the stratum-adjusted test used by InferenceIncidCMH.

Usage

InferenceIncidCMH$new(
  des_obj,
  model_formula = NULL,
  se_est_num_vectors = 5000L,
  verbose = FALSE
)

Arguments

des_obj

A completed design object.

model_formula

Optional formula for covariate adjustment.

se_est_num_vectors

For non-block designs, the number of randomization vectors drawn from the design to estimate the standard error. Default 1000L.

verbose

Logical. Whether to print progress messages.

Returns

A new InferenceIncidCMH object.


InferenceIncidCMH$clone()

The objects of this class are cloneable with this method.

Usage

InferenceIncidCMH$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples