causal_testing.estimation.cubic_spline_estimator

This module contains the CubicSplineRegressionEstimator class, for estimating continuous outcomes with changes in behaviour

Module Contents

Classes

CubicSplineRegressionEstimator

A Cubic Spline Regression Estimator is a parametric estimator which restricts the variables in the data to a

Attributes

logger

causal_testing.estimation.cubic_spline_estimator.logger
class causal_testing.estimation.cubic_spline_estimator.CubicSplineRegressionEstimator(base_test_case: causal_testing.testing.base_test_case.BaseTestCase, treatment_value: float, control_value: float, adjustment_set: set, basis: int, df: pandas.DataFrame = None, effect_modifiers: dict[causal_testing.specification.variable.Variable, Any] = None, formula: str = None, alpha: float = 0.05, expected_relationship=None)

Bases: causal_testing.estimation.linear_regression_estimator.LinearRegressionEstimator

A Cubic Spline Regression Estimator is a parametric estimator which restricts the variables in the data to a combination of parameters and basis functions of the variables.

regressor
fit_model(data=None) statsmodels.regression.linear_model.RegressionResultsWrapper

Run linear regression of the treatment and adjustment set against the outcome and return the model.

Returns:

The model after fitting to data.

estimate_ate_calculated(adjustment_config: dict = None) causal_testing.estimation.effect_estimate.EffectEstimate

Estimate the ate effect of the treatment on the outcome. That is, the change in outcome caused by changing the treatment variable from the control value to the treatment value. Here, we actually calculate the expected outcomes under control and treatment and divide one by the other. This allows for custom terms to be put in such as squares, inverses, products, etc.

Param:

adjustment_config: The configuration of the adjustment set as a dict mapping variable names to their values. N.B. Every variable in the adjustment set MUST have a value in order to estimate the outcome under control and treatment.

Returns:

The average treatment effect.