Repository navigation
ENH/REF generic get_prediction - #7870
Conversation
|
test failure: I missed one call to moved module |
|
supporting endpoint transformation for k_extra (e.g. NBP) looks messy in the current setting. I need something like a linear/link version of NonlinearDeltaCov that takes summary statistics linear jacobian, cov and link. Refactoring the current code would either require to extend |
64450c3 to
1b9707c
Compare
|
latest commit "ENH/REF: add get_prediction_monotonic, add get_prediction to CountRes… " |
|
BUG with pandas exog_predict with pandas in an NB example (data is transformed docvis, #1742 (comment) ) In Stata (params agree at 4 to 6 decimals) note, Stats uses delta method confint, I use endpoint in this case: |
|
This pull request introduces 2 alerts and fixes 1 when merging 1b9707c into 718b4c5 - view on LGTM.com new alerts:
fixed alerts:
|
|
Stata margin by default computes average prediction with delta method inference My get_prediction can now do this also (but currently returns a NonlinearDeltaCov instance |
|
CI failures are pep-8 and LGTM unused name more results: Stata using predict_nl It looks like we need to specify explicit linear predictor expression. Stata also has an option for p-value for H0: predicted=0, but those are very small because predicted values are large. This creates the corresponding columns in the data matrix Results agree with mine, except small differences in confint, delta versus endpoint method |
|
and confint for average prob(y = 0) and y=1 Stata: mine (still no option to choose for which y=k to compute prob): |
|
Stata also allows margins for sum of probabilities for intervals of k and for survival function sf value. |
|
Related, I would also like to get the quantile function, ppf and isf, but for discrete rv, those are step functions and delta method does not work (we need at least continuous first derivatives), |
|
ZeroInflatedNegativeBinomialP predict or get_prediction changes offset, exposure if None If offset and exposure are not given by the user, then the attribute is not available in the Most likely, there is a problem in the code of this PR. |
|
BUG: zeroinflated model.predict returns nobs array of exog_infl is not proved but scalar exog is. predict needs to raise an exception if exog is specified in predict, but exog_infl is not and model.exog_infl is not just a constant. |
|
api of NonlinearDeltaCov and PredictionResults are not consistent I currently cannot write common unit test functions or methods for negbinp and zinegbinp Design: I will add a prediction results wrapper around NonlinearDeltaCov. |
1b9707c to
e76cac7
Compare
|
Hello @josef-pkt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-11-18 21:48:38 UTC |
|
right now I have several different version of get_prediction_xxx and PredictionResult unit tests for NBP with link/monotonic version for mean, and ZINBP with all delta method Another case will be BetaModel with two link functions. I haven't tried it yet. undecided: default for I also still would like to add freq_weights, so we can compute "population averages". Need meta-information in Prediction results instance, e.g. which, if delta method, ... another undecided: replicating margins |
|
This pull request introduces 3 alerts and fixes 1 when merging e76cac7 into ac106a5 - view on LGTM.com new alerts:
fixed alerts:
|
e76cac7 to
63b4e8c
Compare
|
This pull request introduces 1 alert and fixes 1 when merging 63b4e8c into 6d7d42e - view on LGTM.com new alerts:
fixed alerts:
|
|
naming question Internally we use
update renamed to |
|
get_prediction for Logit and Poisson was added in #7597 for 0.14. I can still change the return class unit tests to change are statsmodels.genmod.tests.test_glm.TestGlmPoisson and TestGlmBernoulli |
|
I need to add link to Logit and Probit for generic get_prediction. Adding link and family (already in countmodels) as public methods/property takes us further down the "inverse" path. |
63b4e8c to
eed7e1f
Compare
|
I'm moving get_prediction to DiscreteResults. |
|
This pull request fixes 1 alert when merging eed7e1f into 6d7d42e - view on LGTM.com fixed alerts:
|
|
The latest commit broke MLEInfluence, failures/errors in statsmodels/stats/tests/test_influence.py for Logit and Poisson I still need more consistency in post-estimation API. And large parts of the newer post-estimation features still don't handle multilink models like BetaModel. That will need another round of refactoring across the board. update amended and force pushed, alias methods in glm and regression PredictionResults classes The influence classes themselves use |
|
Another naming problem in multilink models like Our second link is for a variance/scale/dispersion parameter, which is in most cases not the same as the variance itself. one more:
|
eed7e1f to
e5166ef
Compare
|
This pull request fixes 1 alert when merging e5166ef into 6d7d42e - view on LGTM.com fixed alerts:
|
|
all green, time to clean up I need followup PRs for multinomial #7888 and for multilink BetaModel. I haven't looked yet at use cases for joint cov and wald_test that we get with NonlinearDeltaCov. I haven't added any deprecation warnings in this PR. Those need to be added later. Final API is still somewhat open. |
e5166ef to
c764bbc
Compare
|
This pull request introduces 2 alerts and fixes 1 when merging c764bbc into 6d7d42e - view on LGTM.com new alerts:
fixed alerts:
|
963d91b to
9b83bbf
Compare
|
That's about finished for this round. next ? |
|
This pull request introduces 2 alerts and fixes 1 when merging 9b83bbf into 1fd553d - view on LGTM.com new alerts:
fixed alerts:
|
9b83bbf to
6e484f4
Compare
|
This pull request introduces 2 alerts and fixes 1 when merging 6e484f4 into 1fd553d - view on LGTM.com new alerts:
fixed alerts:
|
see #7833 for design and comments