Repository navigation
ENH: add discretized count distribution - #7488
Conversation
|
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-06-15 18:00:19 UTC |
|
This pull request introduces 1 alert when merging e2e7d1c into 1a57918 - view on LGTM.com new alerts:
|
|
failure in style check, but no problems (yet) across scipy versions. |
|
I decided to use scale keyword and not support discrete underlying distribution. Poisson worked in my initial version, but will not work anymore after the last commit. |
edaf122 to
44bcf15
Compare
44bcf15 to
0e6edda
Compare
|
This pull request introduces 1 alert when merging 77f72e1 into 1a57918 - view on LGTM.com new alerts:
|
|
Notes to Pareto Descretinzing classes work when using Pareto. Failure is in chisquare test which produces nan because prob(y=0) = 0. switching to Lomax, then everything works, shape name differs between Pareto and Lomax. I haven't tried |
|
the basics looks fine now possible test case for regression models: case with only one link function: A bit similar to AFT: scale parameter uses log link with regressors, shape parameter of the underlying distribution are scalar |
|
This pull request introduces 1 alert when merging d67bcc3 into 1a57918 - view on LGTM.com new alerts:
|
|
gamlss in R has discrete burr 12 not sure what parameterization they are using. mu doesn't look completely like scale reference is but docstring mentions that gamlss uses a different parameterization an application with gamlss for discretized weibull: |
|
blow up, e.g. |
|
change in plans: Replicating gamma example from Chakraporty et al 2012 (table 7) with MLE is just a few lines, and matches results except for aic. no default start_params (yet), model sublcasses GenericLikelihoodModel |
|
fixing a shape parameter in multiparameter distributions like burr12 will be useful, both for special cases, like pareto in burr12, and because in some multi parameter distributions some parameters can be closely related and not well identified separately. adding list of special cases to docstrings would also be helpful, avoids having to look it up or search for it each time. properties of distributions for start_params, specification search and docs. aside Burr article has one example for teeth, but max physical count is 4. The version in this PR has fixed support a=0, b=inf. |
…distributions]discrete
|
This pull request introduces 1 alert when merging df5896f into c2d87b6 - view on LGTM.com new alerts:
|
|
looking at issues with problems in specifically does it work when
it breaks, but it looks like it's because
|
|
parameter restrictions
In the case here, we have several parameters that could be restricted. |
|
another change in plans: move models for distribution fitting to separate module The estimation module can get other classes, e.g. #2527 fit for scipy distributions (that could be similar to what I have in here) |
|
a notebook with examples using this PR |
|
found a bug: also, I haven't implemented ppf, isf. They should follow from trunc(x_continuous) behavior, but a bit tricky whether open or closed. i.e. continuous cdf at int maps to lower count. I can use floor or trunc, except if continuous quantile is an int update Either I leave numerical precision to the user, and fix the unit test or I add a fudge factor I also need to implement sf and isf to get better precision in the upper tails. |
|
test case correction things match so far, including ppf and isf (with fudge factor) |
|
This pull request introduces 1 alert when merging f4299c3 into c2d87b6 - view on LGTM.com new alerts:
|
|
first time version specific test failures. incorrect there is already a seed in the test method |
f4299c3 to
245b5e5
Compare
|
The last commit after which the failure started changed my update I guess it created only a single observation. It's strange that we could estimate parameters, AFAICS, only lomax failed to converge. There is no hardocded nobs or check that the data has the correct length. I will add an assert for len(y). |
245b5e5 to
02eb87f
Compare
|
another failure with scipy <1.5, discrete ppf, was wrong at boundary if loc!=0 AFAICS in the scipy code, isf has not been fixed for loc at boundary |
|
This pull request introduces 1 alert when merging 02eb87f into 1b009b1 - view on LGTM.com new alerts:
|
02eb87f to
464b4dc
Compare
|
another amend and force push. This should now fix the unit tests for problems with scipy |
|
This pull request introduces 1 alert when merging 464b4dc into 1b009b1 - view on LGTM.com new alerts:
|
|
all green |
|
distribution docs needs updating I will add the count distributions for now, and leave more rewriting and reorganizing for later. For example, I don't know what the status of statsmodels.distributions.edgeworth is. I haven't looked at expansions in a very long time. The last substantive change was in 2014 (by Evgeni), since then only maintenance. |
|
This pull request introduces 1 alert when merging 0ce4f9d into 1b009b1 - view on LGTM.com new alerts:
|
|
aside: statsmodels.distributions does not have an I don't want to add more to the another aside: inconsistency in naming generalized poisson GPP distributions: |
|
I just saw that I'm not implementing |
0ce4f9d to
1564321
Compare
|
codecov is high, just a few lines missing cases in unit tests:
and some exceptions, ValueError |
|
This pull request introduces 1 alert when merging 1564321 into 1b009b1 - view on LGTM.com new alerts:
|
see #7479 count models based on discretizing a continuous distribution
update:
this now also includes two fixes for base GenericLikelihood Mixin
init_keysopen decision: do we use scale keyword of underlying distribution, or do we handle scale explicitly instead of delegating?
update: decided: explicit scale internally,
currently: parameter, args handling is inconistent in scale, it's a shape parameter for the discrete discretized distribution.
if we use scale keyword, then it will not work if the underlying distribution is discrete, which doesn't allow
scale