Skip to content

SUMM: clipping away from boundary in discrete #3924

Open

Description

@josef-pkt

a general issue to get an overview of boundary problems in discrete

GLM/genmod has clipping in all or most places to keep away from boundaries 0 and 1. discrete models almost have no clipping with the exception of Probit, and in some cases the new count models.

The main problem is that if values are at the boundaries 0, 1 for binary and multinomial and 0 for count models, then some values result in infs or nans, and raise overflow or similar warnings.

Overflow in exp is a similar problem, but whether clipping would help to avoid exp(x) is inf is less clear.

see also my related summary for problems in open parameter spaces when we approach the limits https://groups.google.com/d/msg/pystatsmodels/r48gDjpgPBk/1BXmBfjBAQAJ

Two reasons why we need clipping:

  • during optimization values are tried out that are too close to the boundary, or at the boundary if it is associated with exp overflow. This can happen even if the underlying model is fine with the data.
  • in corner cases it is possible that an estimate approaches the boundary or is at the boundary, especially in combination with over- or underflow. E.g. in perfectly predicted cases the probability will be 1. If there are no events in count model, then the estimate for the mean could be zero.

related problems:

  • variance estimate goes to zero
  • extra shape parameter goes to zero but is numerically impossible, e.g. Negative Binomial dispersion parameter
  • mixing probability (with Logit, Probit or similar) goes to zero or one.
  • intentional violation, e.g. GLM domain violations with non-canonical links #2208 GLM without restrictive link (example log-binomial)

issues for basic discrete models:

#3337 negative binomial
#3635 MNLogit overflow and zeros
#3923 Logit overflow and zeros

#3863 alpha -> 0 in NegBin

We need to add numerical improvements and clipping into all models where this is a problem.
(i.e. compatify away from boundary)
np.clip(temp, FLOAT_EPS, 1 - FLOAT_EPS)
or use np.nextafter(1, 0) (used by Evgeny in count_model)

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