Treatment Effect Inference

class inference(df: pd.DataFrame, col_y: str = 'Y', col_t: str = 'T', col_x: list = None, confounder_cols: list = None)

Class of linear inference methods for estimating average treatment effect and heterogeneous treatment effect.

After conducting the coarsened exact matching and imbalance checking, we can estimate the average treatment effect ATT and heterogeneous treatment effect HTE with statistical inference methods.

Ordinal least square linear regression and weighted least square linear regression methods are provided for the ATT estimation, and the linear double machine learning method is provided for the HTE estimation.

Parameters:
  • df (pd.DataFrame) – The dataframe after matching.

  • col_y (str) – The column name of dependent variable Y in your dataframe. If not specified, it would be “Y”.

  • col_t (str) – The column name of treatment variable T in your dataframe. If not specified, it would be “T”.

  • col_x (list) –

    A list of column names of control variables X in your dataframe, which must be specified.

    Names of confounders should not be included in this list.

  • confounder_cols (list) – A list of column names of confounders W in your dataframe, which must be specified.

linear_att()

Method for estimating the ATT with the ordinal least square linear model.

Return the estimated ATT and print out the model summary.

weighted_linear_att()

Method for estimating the ATT with the weighted least square linear model.

Return the estimated ATT and print out the model summary.

linear_dml_hte(self, final_model: str = 'ols_linear')

Method for estimating the HTE with the linear double machine learning method.

Return the average treatment effect on treated ATT, conditional average treatment effect CATE, R2 score of the model.

Parameters:

final_model (str) – You can choose among [‘ols_linear’, ‘lasso’, ‘ridge’] as your second stage model.

Returns:

float: conditional average treatment effect on treated CATE

list: heterogeneous treatment effect HTE,

float: R2 score of the model