Skip to content

BUG/Design: integer overflow when endog is int #3919

Closed

Description

@josef-pkt

In countmodels the endog is int32 in a simple example. We don't currently promote to float.

In GeneralizedPoisson, the hessian produces wrong results in some cases for dldada because of integer overflow.

Is there a problem if we always promote endog in count models to float64? or at least promote if int?

The problem shows up if there are some computation that only involve endog. e.g.
y**2 * (y - 1) overflows, while y**2. * (y - 1.) looks fine

(also never trust an integer power)

(several hours of debugging to see what causes the "sometimes" bug)

Activity

  1. josef-pkt commented on Sep 21, 2017

    @josef-pkt
    MemberAuthor

    For now I promote dtype is CountModels. With the exp anything less than float64 is too fragile and prone to overflowing. (i.e. no lower memory dtypes are allowed)

           # promote dtype to float64 if needed
            dt = np.promote_types(self.endog.dtype, np.float64)
            self.endog = np.asarray(self.endog, dt)
            dt = np.promote_types(self.exog.dtype, np.float64)
            self.exog = np.asarray(self.exog, dt)
    

    changes will be included in upcoming llnull PR

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