causalkit.inference.ttest#

causalkit.inference.ttest(data, confidence_level=0.95)[source]#

Perform a t-test on a CausalData object to compare the outcome variable between treated (T=1) and control (T=0) groups. Returns differences and confidence intervals.

Parameters:
  • data (CausalData) – The CausalData object containing treatment and outcome variables.

  • confidence_level (float, default 0.95) – The confidence level for calculating confidence intervals (between 0 and 1).

Returns:

A dictionary containing: - p_value: The p-value from the t-test - absolute_difference: The absolute difference between treatment and control means - absolute_ci: Tuple of (lower, upper) bounds for the absolute difference confidence interval - relative_difference: The relative difference (percentage change) between treatment and control means - relative_ci: Tuple of (lower, upper) bounds for the relative difference confidence interval

Return type:

Dict[str, Any]

Raises:

ValueError – If the CausalData object doesn’t have both treatment and outcome variables defined, or if the treatment variable is not binary.