
Simple Mean-Difference Inference with Pooled Variance
Source:R/inference_all_simple_mean_diff_pooled_var.R
InferenceAllSimpleMeanDiffPooledVar.RdFits the same unadjusted mean-difference point estimate as
InferenceAllSimpleAverageDiff,
\(\hat\beta_T = \bar y_T - \bar y_C\), but performs inference via the
classical pooled equal-variance Student's t-test instead of
Welch's unequal-variance version: pooled variance \(s_p^2 =
\left((n_T-1)s_T^2 + (n_C-1)s_C^2\right)/(n_T+n_C-2)\), standard error
\(s_p\sqrt{1/n_T + 1/n_C}\), and exact degrees of freedom \(n_T+n_C-2\)
— see $compute_asymp_confidence_interval() for the full formula.
This assumes the two arms have equal population variance; prefer
InferenceAllSimpleAverageDiff
when that assumption is doubtful, since the pooled estimator's nominal
coverage degrades under heteroskedasticity with unequal arm sizes. This
class does not support censored survival data (enforced at construction).
This class has no likelihood tier (likelihood_tier = "none") and
provides asymptotic Wald, randomization, and bootstrap (including Bayesian
bootstrap) confidence intervals and p-values. Warm starts are disabled for
this class, since the simple mean difference is a closed-form estimator
(no iterative fit to warm-start).
Initialize simple pooled-variance mean-difference inference
for continuous responses and prepare the pooled standard-error
calculation used by
InferenceAllSimpleMeanDiffPooledVar.
Disables warm starts (closed-form estimator) and asserts
des_obj has no censored observations (unsupported by this
class).
Computes a \(1-\alpha\) level confidence interval for the
simple (unadjusted) mean-difference treatment effect
\(\hat\beta_T = \bar y_T - \bar y_C\), using the classical
pooled equal-variance Student's t-test formula (unlike
InferenceAllSimpleAverageDiff's
Welch unequal-variance version): the pooled variance estimate
\(s_p^2 = \left((n_T-1)s_T^2 + (n_C-1)s_C^2\right) / (n_T+n_C-2)\)
gives standard error \(\widehat{\mathrm{SE}}(\hat\beta_T) =
s_p\sqrt{1/n_T + 1/n_C}\) with exact degrees of freedom \(n_T + n_C -
2\); the interval is \(\hat\beta_T \pm t_{\mathrm{df}, 1-\alpha/2}\,
\widehat{\mathrm{SE}}(\hat\beta_T)\). Assumes equal population
variances in the two arms — use
InferenceAllSimpleAverageDiff
instead when that assumption is doubtful. Requires at least 2
observations per arm; otherwise returns c(NA, NA). See
InferenceAsymp for the shared
asymptotic confidence-interval contract this participates in.
Computes a two-sided pooled-variance Student's t-test
p-value testing \(H_0: \beta_T = \code{delta}\), from the same
pooled standard error and exact \(n_T+n_C-2\) degrees of freedom
used by $compute_asymp_confidence_interval() — see that
method's documentation for the full formula. See
InferenceAsymp for the shared
asymptotic two-sided p-value contract this participates in.
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 | subjects | regular | theory | [Fisher1935], [LehmannRomano2005] |
wald | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Hall1992] |
jackknife | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [ShaoTu1995] |
bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Hall1992] |
bayes_boot | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Rubin1981], [Lo1987] |
rand_bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Hall1992], [Kallus2018] |
The point estimate is unbiased under randomization (theory: [Neyman1923], [ImbensRubin2015]).
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.
Design-specific differences from the table:
On any design with unequal allocation (
prob_Tnot 0.5), forwald,jackknife,bootstrap,bayes_boot,rand_bootstrap: the effective n is the size of the smaller arm.On
DesignFixedBinaryMatch,DesignFixedBlocking,DesignFixedGreedy,DesignFixedGreedyDOptimal,DesignFixedMatchingGreedyPairSwitching,DesignFixedOptimal,DesignFixedOptimalBlocks,DesignFixedRerandomization,DesignSeqOneByOneKK14,DesignSeqOneByOneKK21,DesignSeqOneByOneKK21stepwise,DesignSeqOneByOnePocockSimon,DesignSeqOneByOneSPBR, forwald: the error order is \(O(1)\) (design mismatch; [BaiRomanoShaikh2021], [BugniCanayShaikh2018], [MaHuZhang2015], [LiDingRubin2018]).On
DesignFixedBlockedCluster,DesignFixedCluster, forwald,jackknife,bootstrap,bayes_boot,rand_bootstrap: the effective n is the number of clusters.
References
Student [Gosset, W. S.] (1908). "The Probable Error of a Mean." Biometrika, 6(1), 1-25, doi:10.1093/biomet/6.1.1 , for the pooled-variance two-sample t-test 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.
[BaiRomanoShaikh2021] Bai, Y., Romano, J. P., and Shaikh, A. M. (2021; in print 2022). "Inference in Experiments with Matched Pairs." Journal of the American Statistical Association, 117(540), 1726-1737.
[BugniCanayShaikh2018] Bugni, F. A., Canay, I. A., and Shaikh, A. M. (2018). "Inference under Covariate-Adaptive Randomization." Journal of the American Statistical Association, 113(524), 1784-1796.
[MaHuZhang2015] Ma, W., Hu, F., and Zhang, L. (2015). "Testing Hypotheses of Covariate-Adaptive Randomized Clinical Trials." Journal of the American Statistical Association, 110(510), 669-680.
[LiDingRubin2018] Li, X., Ding, P., and Rubin, D. B. (2018). "Asymptotic Theory of Rerandomization in Treatment-Control Experiments." Proceedings of the National Academy of Sciences, 115(37), 9157-9162.
[Neyman1923] Neyman, J. (1923, transl. 1990). "On the Application of Probability Theory to Agricultural Experiments." Statistical Science, 5(4), 465-472.
[ImbensRubin2015] Imbens, G. W., and Rubin, D. B. (2015). Causal Inference for Statistics, Social, and Biomedical Sciences. Cambridge University Press.
Super class
Inference -> InferenceAllSimpleMeanDiffPooledVar
Methods
Public methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()Inference$compute_estimate()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()
InferenceAllSimpleMeanDiffPooledVar$new()
Usage
InferenceAllSimpleMeanDiffPooledVar$new(
des_obj,
model_formula = NULL,
verbose = FALSE,
smart_cold_start_default = NULL
)Arguments
des_objA completed design object.
model_formulaOptional covariate formula. It is accepted for interface consistency but does not change the estimate or standard error, which use only the responses and treatment assignments (no covariate adjustment). If
NULL(default), the formula from the design object is used.verboseWhether to print progress messages.
smart_cold_start_defaultWhether to use smart cold start values.
InferenceAllSimpleMeanDiffPooledVar$compute_estimate_with_bootstrap_weights()
Recomputes the pooled-variance difference in means and its
pooled (equal-variance) standard error under bootstrap weights, so
bootstrap and studentized intervals use the same variance convention as
the asymptotic methods; see
InferenceBayesianBootstrap.
Examples
set.seed(1)
seq_des = DesignSeqOneByOneBernoulli$new(n = 20, response_type = 'continuous')
for (i in 1:20) {
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
}
seq_des$add_all_subject_responses(rnorm(20))
inf = InferenceAllSimpleMeanDiffPooledVar$new(seq_des)
inf$compute_estimate()
#> [1] -0.3011212
inf$compute_asymp_confidence_interval()
#> 2.5% 97.5%
#> -0.9515388 0.3492964
inf$compute_asymp_two_sided_pval()
#> [1] 0.3436151