causalis.scenarios.classic_rct.inference.ttest.ttestttest
Perform a Welch two-sample t-test comparing outcomes between groups.
The Welch t-test (also known as the unequal variances t-test) is used to test the hypothesis that two populations have equal means. It is more robust than Student’s t-test when the two samples have unequal variances and/or unequal sample sizes.
Notes
The Welch t-statistic is calculated as:
The degrees of freedom $\nu$ are approximated using the Welch-Satterthwaite equation:
For the relative difference (percent lift), the variance is estimated using the Delta method:
Examples
Parameters
- dataCausalData
The CausalData object containing treatment and outcome variables.
- alphafloat, default 0.05
The significance level for calculating confidence intervals.
Returns
A dictionary containing: - p_value: Welch t-test p-value. - absolute_difference: $\bar{Y}_1 - \bar{Y}_0$. - absolute_ci: (lower, upper) CI for absolute difference. - relative_difference: Percent change relative to control. - relative_se: Delta-method standard error for the relative difference. - relative_ci: (lower, upper) CI for relative difference.
Canonical target
causalis.scenarios.classic_rct.inference.ttest.ttest
Sections