Repository navigation
Open
Description
What notebooks do we need to add, especially for recently added features?
I don't have an overview and most of my private notebooks are dev notebooks with extra experiments or using outdated pre-merge api.
my 0.14 roadmap #7720
overview postestimation #7707
- generic, general
- cov_type, AFAIR we don't have a notebook in examples nor in rst docs
- hypothesis test in models, no notebook AFAICS
- t_test and t_test_pairwise have examples in docstrings, but not wald_test
- a bit is in
postestimation_poissonexample notebook
- for old code
- still no comprehensive doc, notebook for cov_type options
- no GAM notebook
- asymmetric kernel pdf, cdf, bernstein
- post-estimation diagnostics
- influence: docs include influence for logit/glm https://www.statsmodels.org/dev/examples/notebooks/generated/influence_glm_logit.html , more recent version in my folder includes additional trys/experiments
- diagnostic: a few other notebooks when I was working on diagnostic (2021-12-25) try_betareg_prediction_scoretest.ipynb try_influence_zip.ipynb try_truncatedpoisson_new.ipynb try_discrete_get_distribution.ipynb Poisson_diagnostic_.ipynb (I didn't look at those)
- get_prediction need some examples for new features similar to margins and predicted means
- nonlinear prediction wald_nonlinear, not yet public, notebook for use for margins, see issue SUMM/DOC/ENH interaction between continuous, categorical exog #5387
- wald tests, I think we don't have any good summary, quick overview, see e.g. https://stackoverflow.com/a/34232975/333700
good would be full example including wald_test_terms and pairwise - get_prediction: A good example would be for how to use it to simulate a model given exog. Monte Carlo.
- merged
- overview with poisson merged DOC: add notebook for Poisson post-estimation overview #8420
- stats
has very few notebooks in current docs- oneway
several notebooks with examples, dev version and experiments, not systematic,
try_welsh_anova.ipynb (includes oneway for scale/dispersion), try_oneway_equivalence_power_newnames.ipynb, ... - nonparametric brunner-munzel, rank_compare
ex_rank_compate.ipynbmostly dev notebook, 6000 lines, uses merged functions, Munzel and Hauschke example- notebook
try_brunner_munzel.ipynbis original dev notebook, does not use merged functions, has Example from Neuhaeuser and Poulin 2004 and Example from Munzel and Hauschke 2003 - DOC: Notebook rankcompare #8427
- poisson: no good notebook, outdated api, not much text,
too many functions and methods, need to write short overview version- most recent is
check_poisson_inference_pr.ipynb - DOC: add notebook for stats poisson rates #8412
- most recent is
- proportion (can wait until after refactoring)
ex_proportion_2indep_short.ipynbbasic example with all compare and methods in folder notebook_oldtry_anovapower_proportionztest.ipynbbasic example for how to use FTestAnovaPower with effect size
- ...
- oneway
- newer models
- count models, only poisson and negbin in https://www.statsmodels.org/dev/examples/notebooks/generated/discrete_choice_overview.html#Poisson
missing: zero-inflated, new hurdle, NBP, GPP, ...- hurdle: no approximately clean notebook,
try_truncated_hurdle_count.ipynbincludes racd10 example, other notebooks use simulated data
hurdle notebook merged DOC: add notebook for hurdle count model #8424 - truncated not included in hurdle notebook
- zero-inflation: found an old gist notebook of mine https://gist.github.com/josef-pkt/c932904296270d75366a24ee92a4eb2f
- hurdle: no approximately clean notebook,
- beta
- notebook in a gist, might be the cleanest https://gist.github.com/josef-pkt/4d0fd829c8fbc1c4237d989ba3dbb088
- ...
- count models, only poisson and negbin in https://www.statsmodels.org/dev/examples/notebooks/generated/discrete_choice_overview.html#Poisson
- treatment
ex_treatment_effect_after_merge.ipynbexample ok, needs some cleanup and more text- DOC: add notebook for treatment effect #8418
- multivariate
only has PCA - ...
Activity
josef-pkt commentedon Aug 7, 2022
an idea for easier discovery of notebooks:
Add a section on top of https://www.statsmodels.org/dev/examples/index.html with "recently added notebooks" with just a plain list of notebook links (no plots, screen shots)
Another idea would be a "What's new" section with plain list of links to notebook.
The release notes do not have links to notebooks.
josef-pkt commentedon Aug 7, 2022
aside: 0.13.1 and 0.13.2 do not have release notes in docs
https://www.statsmodels.org/dev/release/index.html
josef-pkt commentedon Aug 7, 2022
related: missing theory and no references in docs, for "Things that I made up"
example Influence for zero-inflated:
I have a private dev notebook
try_influence_zip.ipynbwhich prints several warnings about which statistic / variable is used in plots.The docstring has a notes section to point out some problems with the generic MLE definition of influence measures
https://www.statsmodels.org/dev/generated/statsmodels.discrete.count_model.ZeroInflatedPoissonResults.get_influence.html
The class returned by get_influence is MLEInfluence which does not have references for the generic definitions, e.g. of generalized leverage
https://www.statsmodels.org/dev/generated/statsmodels.stats.outliers_influence.MLEInfluence.html
josef-pkt commentedon Aug 8, 2022
Notes: notebook/rst docs ? for postestimation overview
traditional: wald inference and
predictgeneral: GLM, OLS/WLS have model specific implementation, eg. influence
MLE models: generic and model specific
more details mainly for MLE models, currently discrete models and BetaModel
get_prediction
get_influence
get_diagnostic
get_distribution
score_test
work in progress, and not all are available for all main models
both generic and model specific methods
experimental, api and, possibly, definitions and defaults will change (e.g. if generic methods are replaced by model specific methods)
also, there are still some api inconsistencies
example: Poisson
josef-pkt commentedon Aug 16, 2022
get prediction, wald_nonlinear, deltacov:
I don't remember what is actually available, beside get_prediction what="xxx".
e.g. usages similar to margins and prediction average means.
examples for nonlinear functions, e.g. comparison of two predictions,
???
update
AFAICS, my latest notebooks when working on the prediction PR 2021-11-27
check_nonlinear_delta_prediction.ipynb several nonlinear functions, including margins for count models
try_get_prediction_docvis.ipynb docvis data Cameron/Trivedi book (?), countmodels, predict and some diagnostic
josef-pkt commentedon Sep 29, 2022
hurdle model and related is missing from doc, based on sphinx search
and I guess also from
apimerged PR is #7973
My
try_truncated_hurdle_counthas examples including usage ofget_predictionandget_diagnosticfor some of the new count models.Other than that, I don't know what post-estimation is available and verified
checking:
The hurdle, truncated results classes don't define any of the
get_xxxmethods. Those are inherited fromCountResults.unit test in test_truncated_model have good coverage for get_prediction and basic coverage for get_diagnostic.
Also, I don't know if score_test works. (Two part was made to work for BetaModel, but I don't remember about two-submodel cases as in ZI and hurdle models.)
We need to check inherited get_distribution and get_influence
post-estimation overview issue #7707 does not include truncated and hurdle models
naming not clear TruncatedLF
"L" means left, but I didn't remember why "F"
comments in PR are not clear, but they mention "fixed" truncation
This should be added to docstrings
update
I think I remember now after working on an example
"F" stands for truncation point is constant across observation, a fixed truncation point and not observation specific.
keyword:
truncation : int, optionalis scalar and cannot be a nobs arrayTruncatedL, without "F", would allow observation specific left truncation points.AFAIR, truncation can be at any count in the implementation is (almost ?) fully supported
get_distributionis not available,res_h.get_distribution()with hurdle model raisesAttributeError: 'HurdleCountModel' object has no attribute 'get_distribution'get influencein hurdle modelinfl_h = res_h.get_influence()also raises exception with missing model hessian called by MLEInfluencescore_testin hurdle model raiseschecking the zero-truncation submodel
raises with shape mismatch, I guess because the truncation model only has the nonzero observations
raises with
AttributeError: 'TruncatedLFPoisson' object has no attribute 'score_factor'josef-pkt commentedon Sep 29, 2022
I accidentially closed tab with open edits.
short version:
score_test, get_influence and get_distribution raise in hurdle model because of missing, not implemented model methods.
Similarly for the attached truncated model res_h.results_count. get_influence works but raises when accessing cached attributes.
josef-pkt commentedon Oct 8, 2022
missing docs, examples and unit tests: get_prediction with formula
We don't have support for creating prediction design matrices for grids (e.g. emmeans, multicolumn margins), mainly because we don't have enough information from the formula design_info, or it will be a lot of work to get the information for what is available (e.g. interaction effects).
However, users can specify the predict exog, e.g. a grid, using the original data which is preprocessed by the formula transformation in
predict.AFAIR, I never looked at this with an example for new get_prediction features (dmatrix with existing design_info).
for example,
It would be good to have a helper function that creates one observation for each cell of k categorical variables, including interactions defined by the formula. This could be combined with mean for continuous variables, or expanded with a grid or all observations of continuous variables. (predict_at)
But first we need to check and unit test how much is currently supported. It should work correctly by inheritance, delegation or because new features copied the working existing code.
josef-pkt commentedon Oct 20, 2022
for missing docs/notebooks for robust cov_type
https://stats.stackexchange.com/a/206557/14187
https://nbviewer.org/github/josef-pkt/misc/blob/compare_discrete_glm_cluster/notebooks/compare_discrete_glm_gee_cluster_robust.ipynb
https://github.com/vgreg/python-se/blob/master/Standard%20errors%20in%20Python.ipynb
josef-pkt commentedon Jan 9, 2023
gam again, missing notebook
https://stackoverflow.com/questions/75052258/how-to-understand-the-output-of-glmgam-and-apply-the-gam-predict-to-real-case
update
basic example is in gam.rst
https://www.statsmodels.org/dev/gam.html
I don't find a published notebook, the relevant gist seems to be
ex_gam_mpg_basic.ipynbhttps://gist.github.com/josef-pkt/29ad2116e9af0864e5100ded89efe1f5
(other gam gist notebooks look messier, i.e. include dev/trying-out code)
josef-pkt commentedon Jun 8, 2023
VAR, vector_ar is also missing a notebook.
example code is in rst doc, but not in notebook that can be immediately used.
An old conversion to a notebook (gist) is linked to in #2272 (this version from 2015 is most likely outdated)
josef-pkt commentedon Jan 13, 2024
bump for oneway: still no notebook
also docstring is stingy on references, e.g. no reference for Yuen trimmed version
AFAIR, I also used articles that compare anova versions - references for that ?
https://www.statsmodels.org/dev/generated/statsmodels.stats.oneway.anova_oneway.html#statsmodels.stats.oneway.anova_oneway
also other functions
e.g. equivalence_oneway has no references, it only mentions Wellek's Anova
merged PR is #6789 (rebased version)
not many references in this and precursor PRs
superseded PR #6526 has links to other packages, used for unit tests
josef-pkt commentedon Nov 1, 2024
I was looking for a quick example for t_test, wald_test explanation to link to.
However, there is no overview notebook.
They are mentioned in poisson post-estimation notebook.
The example notebook page should have some general/base notebooks at the beginning.
Aside:
docstring examples are inherited. specific model classes do not have model specific example in method docstrings
e.g.
https://www.statsmodels.org/dev/generated/statsmodels.miscmodels.ordinal_model.OrderedResults.wald_test_terms.html
has examples with OLS and Poisson
copilot provides relatively good answer
with link to https://www.statology.org/wald-test-python/ (page is very heavy in ads)
"...\statsmodels\examples\incomplete\ols_tftest.py"
has examples, old script file without much text