Skip to content

ENH/TST: GLM, discrete, saturated model, perfect prediction #3703

Open

Description

@josef-pkt

corner case behavior if we have a model with perfect prediction by design

(I thought I already have an issue, but don't find it right now.
trigger for issue right now: according to their documentation, SPSS handles zero cases in loglike and deviance separately, dropping terms instead of "fixing" them as we do)

examples:

  • contingency table, loglinear model with saturated exog
  • computing saturated reference case for deviance, (I needed to add an epsilon to avoid corners)
  • model with aggregated or averaged data using freq_weights or var_weights

Those would make good test cases for the currently open issues of zero division and similar in GLM families.

Activity

  1. josef-pkt commented on May 3, 2020

    @josef-pkt
    MemberAuthor

    bump

    I just ran into the same problem replicating two sample proportion tests with GLM Binomial PR #6675

    see #2680 for disabling perfect separation exception when using irls

    I also got a zero division warning (raised only once ?)

    en = np.array([[count1, nobs1 - count1], [count2, nobs2 - count2]])
    ex = np.array([[1., 1], [1, 0]])
    mod_glm = GLM(en, ex, family=families.Binomial())
    res_glm = mod_glm.fit(method='bfgs', tol=1e-10, max_start_irls=0)
    
  2. josef-pkt commented on Sep 3, 2021

    @josef-pkt
    MemberAuthor

    exception when null model has perfect fit and scale=0
    #7682 (comment)

  3. josef-pkt commented on Dec 9, 2022

    @josef-pkt
    MemberAuthor

    PR #8552 added option to turn off/on the perfect separation/prediction check, default changed to no exception

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