Propensity Score Matching (PSM)
Estimate the Average Treatment effect on the Treated (ATT) of treatment_ticker exceeding treatment_threshold on dependent_ticker’s return, via Propensity Score Matching (PSM) on covariate_tickers.
Also known as: PSM, nearest-neighbor propensity matching.
For more information about the method, see causal_inference_model.get_propensity_score_matching.
Derives a binary “treatment” indicator the same way get_logistic_regression derives its binary outcome: 1 if treatment_ticker’s return in a given period exceeds treatment_threshold (0.0, i.e. a positive return, by default), else 0. This lets PSM answer e.g. “on periods where treatment_ticker has an outsized/positive move, is dependent_ticker’s return different than it would otherwise be – comparing only periods that LOOK similar on covariate_tickers (to control for the possibility that treatment_ticker tends to move on the same periods/regimes that also independently affect dependent_ticker)?”
Propensity Score Matching (PSM) in Python
get_propensity_score_matching is part of the Econometrics module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_propensity_score_matching as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.econometrics.get_propensity_score_matching(
"AAPL", "MSFT", "Benchmark", period="weekly"
)
Which returns:
| Metric | Value |
|---|---|
| ATT | 0.0335 |
| Std. Error | 0.0060 |
| t-Statistic | 5.5598 |
| P-Value | 0.0000 |
| Matched Pairs | 33 |
| N Treated | 84 |
| N Control | 73 |
Parameters
get_propensity_score_matching accepts the following parameters:
- dependent_ticker (str): The outcome asset.
- treatment_ticker (str): The asset whose return, once it exceeds
treatment_threshold, defines the treatment indicator. - covariate_tickers (str | list[str]): The asset(s) used as covariates to estimate the propensity score – should include asset(s) believed to drive selection into “treatment”.
- treatment_threshold (float, optional): The return threshold defining treatment. Defaults to 0.0.
- period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”.
- column (str, optional): The historical data column to use. Defaults to “Return”.
- caliper (float | None, optional): The maximum allowed logit-propensity-score
matching distance. Defaults to None, which uses Austin’s (2011) rule of thumb
– see
causal_inference_model.get_propensity_score_matching. - add_constant (bool, optional): Whether to include an intercept in the propensity score model. Defaults to True.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.