Skip to contents

Fits the classical Miettinen-Nurminen score method for the risk difference in a two-arm binary trial. The point estimate is the observed risk difference, while confidence intervals and p-values are obtained by inverting the constrained score test under the null \(p_T - p_C = \delta\).

This class is intentionally unadjusted. It operates on the \(2 \times 2\) table induced by treatment assignment and incidence response (counts \(x_T, x_C\) of events among \(n_T, n_C\) treated/control subjects), and is therefore the natural classical binary-endpoint complement to the regression-based incidence methods already in the package. The point estimate is the plain risk difference \(\hat p_T - \hat p_C\); the Miettinen-Nurminen confidence interval and p-value invert a restricted-maximum-likelihood score test of \(H_0: p_T - p_C = \delta\) (via mn_ci_cpp/mn_pvalue_cpp) — under the null, the two arms' event probabilities are re-estimated subject to the constraint \(\hat p_T - \hat p_C = \delta\), and the resulting score statistic is compared to its asymptotic normal distribution, with a small-sample bias correction factor \((n_T+n_C)/(n_T+n_C-1)\) applied to the naive Wald variance used elsewhere (e.g. in $compute_estimate_with_bootstrap_weights(), which never gets this correction since it skips the score-test path entirely). This score-based interval generally has better small-sample coverage than the naive normal-approximation Wald interval on the risk difference.

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 sampleexacteventsregulartheory[Fisher1935], [LehmannRomano2005]
waldasymptotic\(O(n_{eff}^{-1})\)eventsregularassumed default[Hall1992]
jackknifeasymptotic\(O(n_{eff}^{-1})\)eventsregularassumed default[ShaoTu1995]
bootstrapasymptotic\(O(n_{eff}^{-1})\)eventsregularassumed default[Hall1992]
bayes_bootasymptotic\(O(n_{eff}^{-1})\)eventsregularassumed default[Rubin1981], [Lo1987]
rand_bootstrapasymptotic\(O(n_{eff}^{-1})\)eventsregularassumed 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

Miettinen, O., and Nurminen, M. (1985). "Comparative Analysis of Two Rates." Statistics in Medicine, 4(2), 213-226, doi:10.1002/sim.4780040211 , for the restricted-maximum-likelihood score method used here.

[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 -> InferenceIncidMiettinenNurminenRiskDiff

Methods

+ inherited public methods from Inference


InferenceIncidMiettinenNurminenRiskDiff$new()

Uses the shared randomization two-sided p-value contract; see InferenceRand.

Initialize a Miettinen-Nurminen risk-difference inference object for a completed design with an incidence response.

Usage

InferenceIncidMiettinenNurminenRiskDiff$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE
)

Arguments

des_obj

A completed DesignSeqOneByOne object with an incidence response.

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.

verbose

Whether to print progress messages.

Examples

seq_des = DesignSeqOneByOneBernoulli$new(n = 20, response_type = "incidence")
for (i in 1:20) {
  x_i = data.frame(x1 = rnorm(1), x2 = rnorm(1))
  w_i = seq_des$add_one_subject_to_experiment_and_assign(x_i)
  p_i = plogis(-0.8 + 0.5 * w_i)
  seq_des$add_one_subject_response(i, rbinom(1, 1, p_i))
}
seq_des_inf = InferenceIncidMiettinenNurminenRiskDiff$new(seq_des)
seq_des_inf$compute_estimate()


InferenceIncidMiettinenNurminenRiskDiff$compute_estimate()

Computes the observed (unadjusted) risk-difference estimate \(\hat p_T - \hat p_C\) (see class documentation for the full Miettinen-Nurminen inference model). NA if either arm is empty.

Usage

InferenceIncidMiettinenNurminenRiskDiff$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip variance component calculations.


InferenceIncidMiettinenNurminenRiskDiff$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 — this weighted path never computes the Miettinen-Nurminen score-based variance.

Usage

InferenceIncidMiettinenNurminenRiskDiff$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Bootstrap weights at the subject or block level.

estimate_only

Present for interface parity; this method never computes variance components regardless of its value.


InferenceIncidMiettinenNurminenRiskDiff$compute_asymp_confidence_interval()

Computes a \(1-\alpha\) Miettinen-Nurminen restricted-MLE score confidence interval for the risk difference (see class documentation for the full method), by bisection-inverting the score test (mn_ci_cpp) to pval_epsilon tolerance.

Usage

InferenceIncidMiettinenNurminenRiskDiff$compute_asymp_confidence_interval(
  alpha = 0.05,
  pval_epsilon = 1e-07
)

Arguments

alpha

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

pval_epsilon

Bisection tolerance for CI bounds.


InferenceIncidMiettinenNurminenRiskDiff$compute_asymp_two_sided_pval()

Computes a two-sided Miettinen-Nurminen restricted-MLE score p-value (mn_pvalue_cpp) testing \(H_0: p_T - p_C = \code{delta}\) (see class documentation for the full method).

Usage

InferenceIncidMiettinenNurminenRiskDiff$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

The null treatment effect on the risk-difference scale.


InferenceIncidMiettinenNurminenRiskDiff$clone()

The objects of this class are cloneable with this method.

Usage

InferenceIncidMiettinenNurminenRiskDiff$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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

## ------------------------------------------------
## Method `InferenceIncidMiettinenNurminenRiskDiff$new()`
## ------------------------------------------------

seq_des = DesignSeqOneByOneBernoulli$new(n = 20, response_type = "incidence")
for (i in 1:20) {
  x_i = data.frame(x1 = rnorm(1), x2 = rnorm(1))
  w_i = seq_des$add_one_subject_to_experiment_and_assign(x_i)
  p_i = plogis(-0.8 + 0.5 * w_i)
  seq_des$add_one_subject_response(i, rbinom(1, 1, p_i))
}
seq_des_inf = InferenceIncidMiettinenNurminenRiskDiff$new(seq_des)
seq_des_inf$compute_estimate()
#> [1] 0.2083333