Skip to content

SUMM/ENH/BUG: count, GP-P, NB-P follow-up #3887

Open

Description

@josef-pkt

there is a PR #3807 but no issue yet (AFAICS)

  • docstring: I checked and fixed the class docstrings, but some method docstrings are still incomplete and I haven't checked them yet
    e.g. NegativeBinomial.fit doesn't have full list of arguments in code, but then uses inherited generic __doc__ (needs templating)
  • transparams: currently unused, untested, buggy in GPP and NBP, and turned off by default see BUG: transparams and start_params not consistent #3918
  • init_kwds and llnull:
    • NB-P and GB-P don't have the p parameters in llnull AFAICS
    • two part models like ZIP need the second exog in creating the null model
  • llnull: more robust estimation, is already a separate issue -> fixed, enhanced in ENH/REF/BUG Discrete models llnull improvements #3921
  • margins
    • one part models look fine, NB and NB-P is fixed and unit tested (for p=2)
    • truncated models: I guess we need extra computation for the mean and derivatives (i.e. it is not just exp(x b))
    • two part models like ZIP and hurdle: I guess this should raise NotImplementedError for now.
      We have two exog, and several types of mean or conditional mean prediction. This will need larger enhancements.
      -> exception for ZI added in ENH: zero-inflated count models #3908, get_margeff() didn't raise for ZINB but I don't know what the result means.
  • robustness to boundary cases, e.g. ZI-prob goes to zero.
    maybe not much what we can do, but we could provide tools to identify problematic cases, one example score test based on simpler model
  • start_params
    will need review and refactoring to see which models will provide good initial estimates (problem in ZIGPP and ZINBP)

enhancements

question:
Can we use a chisquare test for testing predicted versus empirical probabilities? E.g. corresponding to the histogram plot of aggregated counts or the corresponding cumulative probabilities.

References

Jansakul, N., and J. P. Hinde. 2002. “Score Tests for Zero-Inflated Poisson Models.” Computational Statistics & Data Analysis 40 (1): 75–96. doi:10.1016/S0167-9473(01)00104-9.

Jansakul, N., and John P. Hinde. 2008. “Score Tests for Extra-Zero Models in Zero-Inflated Negative Binomial Models.” Communications in Statistics - Simulation and Computation 38 (1): 92–108. doi:10.1080/03610910802421632.

Ridout, Martin, John Hinde, and Clarice G. B. DeméAtrio. 2001. “A Score Test for Testing a Zero-Inflated Poisson Regression Model Against Zero-Inflated Negative Binomial Alternatives.” Biometrics 57 (1): 219–23. doi:10.1111/j.0006-341X.2001.00219.x.

Activity

  1. josef-pkt commented on Aug 27, 2017

    @josef-pkt
    MemberAuthor

    a partial generic idea:
    The new predict functions are just nonlinear functions of the parameters. So we should be able to use the nonlinear wald/t test version to compute inference for it, i.e. standard errors and confidence intervals with delta method or confidence intervals with endpoint transformation if there is a monotonic mapping from linear predictor to the desired prediction.
    (i.e. predict_nl and test_nl equivalents)

  2. josef-pkt commented on Aug 27, 2017

    @josef-pkt
    MemberAuthor

    score/diagnostic tests for dispersion:
    NBP and GPP assume different functions for the relationship between var and mean. In analogue to overdispersion tests, we could just construct specification tests based on auxiliary regression.

    A possible problem is that it might be difficult to identify or distinguish the patterns of dispersion. For example in the test case for the randhie dataset the resid**2 vs. endog or mean doesn't have a clear pattern in the plot. (i.e. variance does not contain enough information to distinguish distributions that are close to each other.)

    related: One of the differences between GPP and NBP is in how heavy or thick the tails are. There might be some information when looking at extreme observations or outliers.
    (I have no idea how sensitive those models are to outliers.)
    a bit related https://stackoverflow.com/questions/45901898/how-to-specify-tail-value-of-a-poisson-distribution-in-scipy-stats heavy tail alternatives to Poisson. (I never checked in details the logseries distribution in scipy.)

  3. josef-pkt commented on Nov 18, 2020

    @josef-pkt
    MemberAuthor

    I don't find docs for the parameterization of GPP

    we need some formulas in the docstrings

    I don't find an issue or PR with the references for GPP and I don't find any reference to GPP parameterization in docstrings.

    reference for P version of GP is
    Zamani, Hossein, and Noriszura Ismail. "Functional form for the generalized Poisson regression model." Communications in Statistics-Theory and Methods 41, no. 20 (2012): 3666-3675.

    which also has the reference to the NBP version
    Greene, W. (2008). Functional forms for the negative binomial model for count data. Econ. Lett. 99:585–590.

    aside GPP(p=1) has a different parameterization of dispersion coefficient from the standard GP1

    GPP:
    E(y) = mu
    Var(y) = (1 + a * mu^(p-1) )^2

  4. josef-pkt commented on Nov 18, 2020

    @josef-pkt
    MemberAuthor

    predict which == "prob" hardcodes the max count, this should be an option.
    (I would like to get something larger)

            elif which =='prob':
                counts = np.atleast_2d(np.arange(0, np.max(self.endog)+1))
    

    Poisson doesn't have a predict 'prob' option

  5. josef-pkt commented on Nov 19, 2020

    @josef-pkt
    MemberAuthor

    for zigpp

    looks like a good paper with overview, including GP-P version
    Kamalja, Kirtee K, and Yogita S Wagh. 2018. “Estimation in Zero-Inflated Generalized Poisson Distribution.” Journal of Data Science 16 (1): 183–206.

    just very brief skimming,
    published after our new count models PR. they don't mention what software they use for simulations, AFAICS
    they have older articles on GP, using matlab

  6. josef-pkt commented on Dec 1, 2020

    @josef-pkt
    MemberAuthor

    VGAM has NBP and other variants of negbin

    Yee, Thomas W. 2020. “The VGAM Package for Negative Binomial Regression.” Australian & New Zealand Journal of Statistics 62 (1): 116–31. https://doi.org/10.1111/anzs.12283.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions