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.

Small-sample behaviour

How fast the size (and coverage) error of each procedure is expected to vanish as the effective sample size \(n_{eff}\) grows, from EDI's convergence-rate registry (inference_convergence_expectation()). Exact procedures are valid at every n by construction; the others are asymptotic, so a small-sample excess is expected, and its constant is not given by an order. The table is the expectation for a balanced complete-randomization design; it is not a measured size. Reference keys are explained under References.

ProcedureRegimeError orderEffective nRegularityBasisReferences
randfinite sampleexactstrataregulartheory[Fisher1935], [LehmannRomano2005]
waldasymptotic\(O(n_{eff}^{-1})\)strataregularassumed default[Hall1992]
jackknifeasymptotic\(O(n_{eff}^{-1})\)strataregularassumed default[ShaoTu1995]
bootstrapasymptotic\(O(n_{eff}^{-1})\)strataregularassumed default[Hall1992]
bayes_bootasymptotic\(O(n_{eff}^{-1})\)strataregularassumed default[Rubin1981], [Lo1987]
rand_bootstrapasymptotic\(O(n_{eff}^{-1})\)strataregularassumed default[Hall1992], [Kallus2018]

The point estimate's bias is of order \(O(n_{eff}^{-1})\) (assumed default: [CoxSnell1968]).

Rows with basis assumed default: the order shown is the procedure's rate in a regular parametric model, and the cited works establish it for that case only. EDI has not derived it for this class.

References

[Fisher1935] Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.

[LehmannRomano2005] Lehmann, E. L., and Romano, J. P. (2005). Testing Statistical Hypotheses (3rd ed.). Springer.

[Hall1992] Hall, P. (1992). The Bootstrap and Edgeworth Expansion. Springer.

[ShaoTu1995] Shao, J., and Tu, D. (1995). The Jackknife and Bootstrap. Springer.

[Rubin1981] Rubin, D. B. (1981). "The Bayesian Bootstrap." The Annals of Statistics, 9(1), 130-134.

[Lo1987] Lo, A. Y. (1987). "A Large Sample Study of the Bayesian Bootstrap." The Annals of Statistics, 15(1), 360-375.

[Kallus2018] Kallus, N. (2018). "Optimal a priori balance in the design of controlled experiments." Journal of the Royal Statistical Society: Series B, 80(1), 85-112. Section 5 ("Algorithms for inference"), Algorithm 4.

[CoxSnell1968] Cox, D. R., and Snell, E. J. (1968). "A General Definition of Residuals." Journal of the Royal Statistical Society: Series B, 30(2), 248-265 (discussion 265-275).

Super class

Inference -> InferenceIncidCMH

Methods

+ inherited public methods from Inference


InferenceIncidCMH$compute_asymp_confidence_interval()

Two-sided randomization p-value for the treatment effect, using the shared contract of InferenceRandCI. By default the p-value comes from the randomization draws; the Zhang exact randomization test is used only when type = "Zhang" is passed explicitly (where applicable). See that page for the arguments and the returned scalar p-value.

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 and validate the blocked or balanced binary-response design. The class reports the simple mean-difference estimate with the randomization-based (CMH-variance) standard error and Wald-type inference described in the class details; no separate stratum-adjusted CMH test is run.

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, accepted for interface consistency with the covariate-adjusted classes. It is ignored: this class is unadjusted and its estimate, confidence interval and p-value use only the treatment assignments and responses.

se_est_num_vectors

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

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

seq_des = DesignSeqOneByOneRandomBlockSize$new(n = 20, response_type = 'incidence',
  strata_cols = 'x1')
for (i in 1:20) {
  seq_des$add_one_subject_to_experiment_and_assign(
    data.frame(x1 = factor(rep(1:2, 10)[i], levels=1:2)))
}
seq_des$add_all_subject_responses(rbinom(20, 1, 0.5))
inf = InferenceIncidCMH$new(seq_des)
inf$compute_estimate()
#> [1] -0.01010101