Skip to content

WIP ENH: add Treatment effect - #2455

Closed
josef-pkt wants to merge 9 commits into
statsmodels:mainfrom
josef-pkt:treatment_effect
Closed

josef-pkt wants to merge 9 commits into
statsmodels:mainfrom
josef-pkt:treatment_effect

Conversation

@josef-pkt

Copy link
Copy Markdown
Member

This adds treatment effects under ignorability similar to Stata 13 teffects
this also starts a new subdirectory treatment, although I'm not happy about the name yet if it will include missing obervation models and imputation.
(see mailing list)

The first commit is fixing GMM for the t_test to work. I have a separate branch just for that
master...josef-pkt:fix_gmm
which should go into master before this and first commit can be skipped.
update GMM cov_params t_test fix and refactoring was merged into master with PR #2497

see #2443 (and comments) for the main issue

work in progress

Status

currently no unit tests, and example uses uncommitted data file (I don't have Stata >= 13)

unfinished and currently messy structure in parts

  • I have almost all estimators for ATE and POM, ATT is missing
  • GMM classes have most of the structure but not all moment conditions are available yet
  • standard errors via GMM is only available for IPW
  • RegressionAdjustment class is a mix of specific and all other estimator code

glossary

ATE: average treatment effect, average causal effect
ATT: average treatment effect on the treated
POM: potential outcome mean
IPW: inverse probability weighting, inverse propensity score weighting (or weights)
ignorability: no unobserved variables that are correlated with outcome and treatment. conditional independence of outcome and treatment, treatment in outcome regression is exogenous

Extensions

To make some things here more generic, we would need to refactor or enhance other models.

going beyond Stata's teffects

  • generic implementation should be easy to reuse for other double robust estimators
  • diagnostics and plots to evaluate misspecification (Stata 14 got more)
  • combining with penalization estimors, emphasis on model selection in parts of the literature

References

update 2016-03-23

Linden, Ariel, S. Derya Uysal, Andrew Ryan, and John L. Adams. 2016. “Estimating Causal Effects for Multivalued Treatments: A Comparison of Approaches.” Statistics in Medicine 35 (4): 534–52. doi:10.1002/sim.6768.
similar to Cattaneo et al articles, with overview, has only partially formulas, uses Stata 13 plus one extra method, (MMWS marginal mean weighting through stratification) in user package

(I'm planning to add related references at https://github.com/josef-pkt/misc/wiki/Imputation-IPW-Introduction second round of readings was more general for missing values)

@josef-pkt

Copy link
Copy Markdown
Member Author

(TravisCI won't have anything to check, but I need to go back to other things for a while, so opening PR so I don't forget)

@josef-pkt josef-pkt added this to the 0.8 milestone Jun 18, 2015
@josef-pkt

Copy link
Copy Markdown
Member Author

TravisCI shows test failures because my change for GMM cov_params (first commit) in not fully correct.
https://travis-ci.org/statsmodels/statsmodels/jobs/67368282

@josef-pkt

Copy link
Copy Markdown
Member Author

rebased (first commit fix GMM t_test was automatically removed in rebase, no merge conflicts)

AFAIR: has the main functionality but needs lot of API work

@josef-pkt

Copy link
Copy Markdown
Member Author

This creates the treatment folder, which is also created in the newer PR #3647

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.007%) to 90.426% when pulling 5221e83 on josef-pkt:treatment_effect into 90e2af8 on statsmodels:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 90.433% when pulling 5221e83 on josef-pkt:treatment_effect into 90e2af8 on statsmodels:master.

@josef-pkt

josef-pkt commented May 20, 2017 •

Copy link
Copy Markdown
Member Author

no unittests at all, module doesn't count in coverage (i.e. 0 coverage)

@josef-pkt

Copy link
Copy Markdown
Member Author

rebased, no merge conflicts

@coveralls

coveralls commented Nov 1, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.2%) to 81.733% when pulling 2fe996a on josef-pkt:treatment_effect into 5b8f20d on statsmodels:master.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #2455 into master will decrease coverage by 0.14%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2455      +/-   ##
==========================================
- Coverage   79.32%   79.17%   -0.15%     
==========================================
  Files         544      545       +1     
  Lines       81718    81872     +154     
  Branches     9255     9264       +9     
==========================================
+ Hits        64822    64824       +2     
- Misses      14802    14955     +153     
+ Partials     2094     2093       -1
Impacted Files Coverage Δ
statsmodels/treatment/treatment_effects.py 0% <0%> (ø)
statsmodels/tsa/vector_ar/vecm.py 93.87% <0%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b8f20d...2fe996a. Read the comment docs.

@josef-pkt

Copy link
Copy Markdown
Member Author

no test coverage is counted with pytest
Note, the example file has many asserts that can be used for unit tests, assuming we add the data to test folder

@josef-pkt josef-pkt added the superseded Used for PRs with content that is superseded by a newer PR label Feb 14, 2022
@josef-pkt

Copy link
Copy Markdown
Member Author

merged in #8034

@josef-pkt josef-pkt closed this Dec 2, 2022
@josef-pkt
josef-pkt deleted the treatment_effect branch December 2, 2022 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-stats comp-treatment superseded Used for PRs with content that is superseded by a newer PR type-enh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants