
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).
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.
Super class
Inference -> InferenceAllSimpleMeanDiffPooledVar
Methods
+ inherited public methods from Inference
Inference$capabilities()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_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$is_nonestimable()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
Designobject whose entire n subjects are assigned and response y is recorded within.model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.verboseWhether to print progress messages.
smart_cold_start_defaultWhether to use smart cold start values by default for likelihood-based models. Explicit starts always override this object-level policy.
NULL(default) consults the global cold-start dispatch policy.
Examples
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 10, response_type = 'continuous')
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(rnorm(10))
inf = InferenceAllSimpleMeanDiffPooledVar$new(seq_des)
inf$compute_estimate()
#> [1] -0.3356485
# }