Skip to contents

Fits 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.

Value

A new InferenceAllSimpleMeanDiffPooledVar object.

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


InferenceAllSimpleMeanDiffPooledVar$new()

Usage

InferenceAllSimpleMeanDiffPooledVar$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE,
  smart_cold_start_default = NULL
)

Arguments

des_obj

A completed design object.

model_formula

Optional 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.

verbose

Whether to print progress messages.

smart_cold_start_default

Whether to use smart cold start values.


InferenceAllSimpleMeanDiffPooledVar$compute_asymp_confidence_interval()

Usage

InferenceAllSimpleMeanDiffPooledVar$compute_asymp_confidence_interval(
  alpha = 0.05
)

Arguments

alpha

Confidence level.


InferenceAllSimpleMeanDiffPooledVar$compute_asymp_two_sided_pval()

Usage

InferenceAllSimpleMeanDiffPooledVar$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect value.


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.

Usage

InferenceAllSimpleMeanDiffPooledVar$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

If TRUE, skip variance calculations.


InferenceAllSimpleMeanDiffPooledVar$clone()

The objects of this class are cloneable with this method.

Usage

InferenceAllSimpleMeanDiffPooledVar$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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.6736107
# }