Repository navigation
Open
Labels
Milestone
Description
-
Model/Results attributes consistency
GLMResults._endog-->self.endogor justself.model.endogself._endog in GLMResults #4028- some Results classes attach
endog, exog, nobs,..., others don't. - Results attributes getting pinned to models GLM attributes #4016, dont set model.df_model and model.df_resid in results.__init__ #3984
- Attributes in FooResultsWrapper FAQ-D/REF: setting attributes in wrapped results instance #3920
- Make
**kwargsexplicit where possible, validation REF/ENH: verify valid model.__init__ keywords #3890, Make keyword args explicit #4019, check for valid misspelled keywords in models #2163 - Avoid creating new attributes outside of
__init__. Ideally avoid changing things in-place. Attribute Existence Ambiguity #3787. - LikelihoodModelResults object has no attribute mle_retvals AttributeError: 'LikelihoodModelResults' object has no attribute 'mle_retvals' #3708
- "J" in GEEMargins? "J" in GEEMargins? #3671
- cov_struct.Nested AttributeError 'vcomp_coeff' cov_struct.Nested AttributeError 'vcomp_coeff' #3668
- fit_regularized has no get_prediction, cov_params ENH: fit_regularized has no get_prediction, cov_params #3626
- PoissonZiGMLE: predict not implemented? PoissonZiGMLE : predict not implemented? #3496
- AR/ARMA/... avoid
set_sigma2pattern; avoid setting model attributes that are really Result attributes duringfit. - VAR, trend needs to be in
__init__REF VAR, trend needs to be in__init__- wrong model state #2273 (this one is tough but would be a huge win) - required attributes of models and results FAQ-D/SUMM: required attributes of models and results #1970
-
Class Hierarchy
- VARResults, SVARREsults, VECMResults don't subclass Results (TODO: double-check).
DiscreteResults.__init__doesn't callsuper(...)- This makes it harder to reason about what attributes can consistently be expected to exist in a Results instance.
- SVAR should subclass VAR, will raise AttributeError in
fitifselect_orderis reached. - tsa.statespace has some special handling for model.data. Life would be better if special cases were mainlined.
- MICEResults subclasses LikelihoodModelResults, but MICE does not subclass Model. So MICEResults.model does not behave as expected. Bug fix for summary_col on summary2.py #3324
-
get_robustcov_results- Defined in several places; There Can Be Only One get_robustcov mismatch? #4014
- Usually called in
FooResults.__init__, but sometimes called inFooModel.fitInconsistency in get_robustcov usage #4025 - Small differences between the versions in linear_model vs base.covtype
- Small differences between the versionsin regime_switching vs statespace
-
Naming Consistency
- Lots of places in sandbox and tsa that don't follow naming conventions Implement deprecated_alias, with tests #4015
self.y-->self.endogin e.g. VARResults- Naming of weights arguments in WLS Naming of weights argument in WLS #3891
- orig_endog vs endog_lagged vs... orig_endog vs endog_lagged vs... #3689
regressorvsexogfor IV, 2SLS? REF naming IV, IV2SLS useregressornotexog#2248
-
Degrees of Freedom
- mixed_linear_model doesn't define df_model, aic/bic define their own
dfvariables df_model in mixed_linear_model #3742 - when to use k_exog vs rank? GEE: question behavior with singular exog, k_exog versus rank #1928
- when to use
# assumes constant? Make this explicit - GEE cases not tested? GEE df_model definition/testing #3726
- aic in AR/ARIMA/... aic in ar/arima/... #3574
- df_resid in ar/arima/var_model df_resid in ar/arima/var_model #3568
- ddof for models ddof for models #2799
- arma as
_ic_df_modelthat is just df_model+1, deprecate/remove
- mixed_linear_model doesn't define df_model, aic/bic define their own
-
Modernization
- Min versions min version? #3999
- Functions that are no longer used because upstream versions are available deprecate py26 compat shims #4008
- cythonize may now be handled upstream, need to check.
- deprecate lower-case link classes REF deprecate lower case link classes #3462
- replace panel with xarray Replace Panel with xarray #2917
-
flake8 cleanup and related
- many
if __name__ == "__main__"blocks should be removed; some of them can be turned into tests - Some base class methods just
passinstead of raising NotImplementedError or AbstractMethodError - Some places print instead of warn check that we
alwayswarn #3163 - lots of commented out print statements
- 1-letter variable names
- many
-
Remove
- sandbox functions that have been replaced MAINT: deprecate sandbox functions that have moved #3442
- removal of deprecated objects for 0.9 Merge pull request #3441 from TomAugspurger/doc-08-mediation-local_fdr #3443
- large parts of
statsmodels.toolsandstatsmodels.statsare never used in the "core", may belong in sandbox. The idea being to have a clear separation between "actively-maintained, thoroughly tested" and "not that". - summary vs summary2: highlander style
-
Other
- MixedLinearModel setting params.fe_params inconsistently MixedLinearModel setting params.fe_params inconsistently #3660
- Can parts of miscmodels be subsumed into discrete.count_models? FAQ-D/SUMM: Miscmodels status? #3738
- Some types of tests return HypothesisTestResults or something, most dont
- Functions with multiple return types/shapes (usually tuples of differing lengths)
- sandbox functions imported by non-sandbox belong in non-sandbox
- tools._testing vs tools.testing?
- To make maintenance easier medium-long term, can we make some things explicitly internal so as to avoid backward-compat concerns?
Activity
josef-pkt commentedon Oct 12, 2017
Thanks for this overview list.
It's more like a SUMMSUMM than what will be digestible in one topic week.
Several or many of the issues will need considerable time, either because of setup cost to figure out what's going on and what's supposed to be going on, or because it takes time to check and write unit tests. Some might be pretty straight forward, and some are waiting for design decisions, and some might not be possible to change/fix.
bashtage commentedon Oct 13, 2017
Well considered list. These clean ups will really help IMO.
josef-pkt commentedon Oct 13, 2017
One clarification:
Large parts of statsmodels.stats are standalone functions similar to scipy.stats and are part of the core functionality of statsmodels in their own right.
All functions and classes in the
apiare supposed to have the basic verifying unit tests. Some functions are pretty settled, some parts are "construction zone".Other functions are in support of models that (at least theoretically) apply to several model types.
e.g. #3954 throwing in more PRs that mainly stalled because of missing API and scope decisions. (Do we want classes that contain everything or a collection of standalone functions as in scipy.)
Also
statsis a very heterogeneous collection of tools and functionality, and a bit of a default location if we don't find a good place to put something.bashtage commentedon Oct 13, 2017
One could examine test coverage when considering whether a function belongs in the main or should be demoted to sandbox.
josef-pkt commentedon Oct 13, 2017
Or write the missing unit tests.
Given that github, in contrast to git, does not follow moving code across modules, I became reluctant to move code across files or move files. (svn/trac was still much better for digging through the history than github is.)
https://codecov.io/gh/statsmodels/statsmodels/tree/master/statsmodels/stats
jbrockmendel commentedon Oct 13, 2017
Yah, looking it over again its a pretty imposing list. My preference would be to get the low-hanging fruit (e.g. the flake8 section) by delegating review/merge responsibilities for "sufficiently obvious" fixes to Chad/Kevin/[?]. The limiting factor there is who you trust to judge "sufficiently obvious".
As in #4027, poor word choice on my part. The thought was/is to identify the subset of tools+stats that is relied upon by base+tsa and the most commonly-used Model/Results classes. This subset should be a focus for QA efforts.
ChadFulton commentedon Oct 16, 2017
I don't doubt you're correct, but I can't immediately find anything that seems particularly special - can you point me to the pieces you're thinking about?
jbrockmendel commentedon Oct 16, 2017
The main place is in sarimax.prepare_data:
Distant runners-up are a) setting
self.data = model.datainMLEResults.__init__and b) settingself.data.param_names = self.param_namesin a handful of places. All pretty benign really.Basically anything that shows up when grepping for ".data" is something that ideally would be hidden as an implementation detail. The fact that you have to access
self.data.orig_endogorself.data.datesin a bunch of places is completely harmless, but the world would be a happier place if it were unnecessary.Update: Now I see that
TimeSeriesModelResults.__init__attachesself.data = model.data. So statespace is off the hook for that. Still counts as a special case.