Repository navigation
Conversation
|
edited with a bit more explanation results in a made up example used in the current unit test The treatment effect is in this example downward trending, i.e. a break in the linear trend plus a shift. ATT is the average of the trend over the treatment periods. see plot in next comment The array of integers in the following are the indices of the controls that have nonzero coefficient, out of 10 controls |
|
not python 2 compatible (print ain't no function there, so we cannot just override it.) green in py3, read in py2 |
| """fit the prediction model | ||
|
|
||
| constraints and regularization are currently mutually exclusive, only | ||
| one of the too can be different from None. |
a150883 to
adaa22d
Compare
|
rebased, no merge conflicts |
|
|
||
| I'm adding `add_const` option separately from the constraints because | ||
| it can be used with OLS and with regularized. | ||
| (just implmentation leak?) |
There was a problem hiding this comment.
spelling. also can you expand on the implementation leak thought?
There was a problem hiding this comment.
No idea right now, i.e. I don't remember.
The general point is that we need an option to handle constant separately or to exclude constant shift if we don't want to extrapolate (as imposed in the original articles, but dropped in other versions)
| constraints=cons) | ||
| params = minout.x | ||
|
|
||
| return Results(self, params, method='OLSSimplexConstrained') |
| def __init__(self, endog, exog, index_unconstrained=None): | ||
| super(OLSSimplexConstrained, self).__init__(endog, exog) | ||
|
|
||
|
|
| """ | ||
|
|
||
|
|
||
| def __init__(self, endog, exog, index_unconstrained=None): |
There was a problem hiding this comment.
is the index_unconstrained arg just ignored?
| assert_allclose(res2.prediction_error * sf, diff_true * sf, atol=atol, rtol=0.1) | ||
| assert_allclose(res3.prediction_error * sf, diff_true * sf, atol=atol, rtol=0.1) | ||
| assert_allclose(res4.prediction_error * sf, diff_true * sf, atol=atol, rtol=0.1) | ||
|
|
There was a problem hiding this comment.
Let's get this right the first time instead of having to come back and turn it into an organized test: setup_class, test_foo... and consider the pytest.mark.smoke idea where pertinent (e.g. plotting)
There was a problem hiding this comment.
Yes, this test needs a complete rewrite, plus we need more unit tests.
first comment in this function: # this just dumps the example into a test
| @@ -0,0 +1,2 @@ | |||
| from statsmodels import NoseWrapper as Tester | |||
| test = Tester().test | |||
There was a problem hiding this comment.
needs to switch to pytest
|
unit tests fail everywhere because of nose |
Codecov Report
@@ Coverage Diff @@
## master #3647 +/- ##
==========================================
+ Coverage 79.32% 79.34% +0.01%
==========================================
Files 544 547 +3
Lines 81718 81901 +183
Branches 9255 9269 +14
==========================================
+ Hits 64822 64981 +159
- Misses 14802 14819 +17
- Partials 2094 2101 +7
Continue to review full report at Codecov.
|
|
I'm wondering, why hasn't this PR been accepted? Could really appreciate this and it's a perfect fit for statsmodels imo. |
|
@tsktsktsk123 The API will most likely need another review to check whether it's usable. (I don't remember how good the inferential statistic are that are already implemented.) |
| from statsmodels.nonparametric.smoothers_lowess import lowess | ||
|
|
||
|
|
||
| class OLSNonNegative(Model): |
There was a problem hiding this comment.
privatize with leading underscore
|
PanelATTResults is missing a summary(), summary_frame method The summary_frame could have predicted values ATE for each period and cumulative I don't remember if there is a summary statistic for the "bootstrap" (treat each time series as candidate), or it's just the plot. we don't have synthetic control or causal impact in the names should be feasible for 0.14 |
|
causality handbook in python has good examples and explanations For ipw, double robust we have more |

see #3631 for background on the type of treatment effect estimator
also includes predictive models with inequality constraints on parameters, see #3632, #1211 for nnls
currently:
background
Also,
statsmodels.treatmentdoesn't exist in master yet.I haven't thought much about names for module and classes.
no nice wrapper things, this is currently pure numpy array based, no missing value handling, ...
Formulas might not be needed here because we only have one type of variables in the basic version, and we don't want to specify a list of names if we have a large number of controls.