Skip to content

BUG/ENH: margins, get_margeff for negative binomial, generalized poisson #3809

Closed

Description

@josef-pkt

get_margeff does not work for NegativeBinomial, and not for new GeneralizedPoisson

The exception points to incorrect shape because extra parameter is not handled.

I'm not sure whether any other methods like the _derivative_predict and _derivative_exog are needed, those are defined for the super class CountModel.
NegativeBinomial has the same exception message as GeneralizedPoisson, so it doesn't look like there is anything special missing about GeneralizedPoisson (yet).

(based on example in a notebook to try out generalized poisson)

res1 in first example is GP-1 results instance, second case is NB-1 results instance

>>> margin_gp1 = res1.get_margeff()
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:713: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_cov = margeff_cov[effects_idx][:, effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:713: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 1; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_cov = margeff_cov[effects_idx][:, effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:714: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_se = margeff_se[effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:715: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff = effects[effects_idx]

>>> margin_nb1 = res_nb1.get_margeff()
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:713: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_cov = margeff_cov[effects_idx][:, effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:713: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 1; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_cov = margeff_cov[effects_idx][:, effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:714: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff_se = margeff_se[effects_idx]
E:\Josef_new\eclipsews\statsmodels_py34_pr\statsmodels\discrete\discrete_margins.py:715: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 0; dimension is 11 but corresponding boolean dimension is 10
  self.margeff = effects[effects_idx]

Activity

  1. josef-pkt commented on Jul 7, 2017

    @josef-pkt
    MemberAuthor

    aside while fixing this in DiscreteMargins.summary: discrete models use exog_names also for the extras in NegativeBinomial and GP, not param_names.

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