Repository navigation
Open
Labels
Milestone
Description
I'm planning to merge some PRs that will need follow-up before the 0.14 release.
This is mainly because I have to bring different parts together and I want to postpone decisions on a final implementation and api. And for now I'm more focused on the overall structure than verifying every detail.
The two big areas will be more post-estimation to existing models, and new categories of models.
General task is API and docstring cleanup and review.
companion to roadmap #7720
post-estimation
- ENH: Diagnostic class rebased #7597
- needs more unit tests, and general review and cleanup
- Discrete scorefactor offset rebased3 #7825
- high line coverage, but needs unit tests for more cases, e.g. Probit, and against hypothesis tests as in comments
- (not immediate followup) extension of score_test to models with extra params (NB), and multilink models (BetaModels)
- (not immediate followup) extending fit_constrained and offset to other models, especially multilink models
- REF/ENH delta method and nonlinear wald test rebased #7758
- undecided: func_args, implement or drop?
- eventually allow transformation classes as func
- undecided: user facing method, test_nl, predict_nl or more generic
- future: use for get_prediction DONE
- needs feedback from internal use cases, possible changes
- ENH/REF generic get_prediction #7870
- REF/ENH: add CountResults.get_diagnostic #7895
- ENH/REF: Scoretest betareg #7907
- ENH: MLEInfluence for two-part models, extra params, BetaModel #7912
- ENH/REF: discrete add get_distribution, add which="var" for NBP, GPP #7929
- ENH: add get_influence to DiscreteResults #7951
- ...
- ...
new models
- ENH: Truncated, hurdle count model rebased #7973.
- not fully finished, cleanup, raise in unsupported parts, check/test or disallow offset and exposure
- this includes more unit tests for generic get_prediction/delta-cov, se, confint against Stata margins,
- get_diagnostic is also inherited, but I only checked and used the plot
- ...
- ENH: Treatment effect rebased #8034
mainly doc improvements and warnings/exceptions DOC/REF/ENH: follow-up to merging treatment effect #8327 - ...
stats
- ENH: hypothesis tests, confint, power for rates (poisson, negbin) #8166
- review docs and api again, maybe add notebook
- could benefit from a few refactoring
- ...
Cleanup inconsistent API, deprecations, still to do:
- discrete fittedvalues
- get_prediction 1-dim or 2-dim
- GLM predict
which, get_prediction Results class
TODO: across the code of most PRs:
- docstring will need review and fixes
- additions to rst docs if not automatic, e.g. new XXXResults classes
- unit test needs more coverage for extras, eg. offset. Maybe refactor and streamline some unit tests. We still get more automatic coverage for new infrastructure like score_test through internal code use like diagnostics, e.g. variable addition, reset tests.
Activity
josef-pkt commentedon Nov 3, 2021
Bug that affects score_test. see #7840 GLM fit_constrained uses wrong df_resid for scale estimate
I'm not sure if it is only the scale estimate in the restricted model. There could also be the wrong df_resid in score_test itself.
I didn't go through the code yet for this.
The following two versions agree for HC0, but not for nonrobust cov_type
the 3rd way of using score_test does not work with HC0
We don't have a constraint matrix if only the params_constrained are given.
Can we still compute sandwiches without knowing R?
sthc = res_full.score_test(params_constrained=res_constr.params, k_constraints=1, cov_type="HC0")raises, final part of traceback:
josef-pkt commentedon Dec 16, 2021
see also #3810 SUMM/REF: Review discrete_model for changes that might still be included.
I didn't review get_prediction for OLS linear model again
That still needs at least improved docs
and
wls_prediction_stdis still used in several parts of statsmodels. We should deprecate it.josef-pkt commentedon Oct 11, 2022
most of the new modules are missing an
__all__That would also be convenient for the notebooks that introduce a new module
josef-pkt commentedon Nov 3, 2022
for
get_predictiondiscrete, GLMquestion: Does Prediction Results have confint_method?
(I will need an example to check)
how are conf_int of predicted values computed as function of params and cov_params?
e.g. "linear", "endpoint", "delta"
corresponding to the 3 get_prediction methods
related: based on the code in discrete, I don't see whether or where Poisson get_prediction uses endpoint transformation if which="mean".
get_prediction is in CountResults and the same (?) between Poisson and negbin
update
dispatch for endpoint transformation is in base
_prediction_inferenceget_prediction, but it uses a model attributeuse_endpoint = getattr(self.model, "_use_endpoint", True)and
elif (which == "mean")and (use_endpoint is True) and (average is False)where is the model attribute set?
update
use_endpoint above defaults to true
So this is correct for all count models in discrete, mean is not a function of dispersion parameters even in NB, GP.
zero-inflated models define their own get_prediction that only uses delta method
BUG (likely): Truncated and Hurdle models do not define prediction, nor does code search find a
_use_endpointattribute.So by inheritance through CountResults, truncated and hurdle models would incorrectly use endpoint transformation for which="mean". ???
aside: Poisson results has
get_influencemethod, but it's the same as the one inherited from DiscreteResults.I guess we can remove it.