
Miettinen-Nurminen Risk-Difference Inference for Binary Responses
Source:R/inference_incidence_miettinen_nurminen_univ.R
InferenceIncidMiettinenNurminenRiskDiff.RdFits 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.
| Procedure | Regime | Error order | Effective n | Regularity | Basis | References |
rand | finite sample | exact | events | regular | theory | [Fisher1935], [LehmannRomano2005] |
wald | asymptotic | \(O(n_{eff}^{-1})\) | events | regular | assumed default | [Hall1992] |
jackknife | asymptotic | \(O(n_{eff}^{-1})\) | events | regular | assumed default | [ShaoTu1995] |
bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | events | regular | assumed default | [Hall1992] |
bayes_boot | asymptotic | \(O(n_{eff}^{-1})\) | events | regular | assumed default | [Rubin1981], [Lo1987] |
rand_bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | events | regular | assumed 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
Public methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()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_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$is_nonestimable()Inference$set_estimand()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
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_objA completed
DesignSeqOneByOneobject with an incidence response.model_formulaOptional 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.
verboseWhether 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.
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.
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.
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).
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