Skip to content

BUG: transparams and start_params not consistent #3918

Closed

Description

@josef-pkt

count models in discrete
It looks like start_params needs to be the transformed params if _transparams=True is used during the optimization

This happens in NegativeBinomial, and might also happen in the new count models NBP, GPP, ...

# use start_params, otherwise all nans
res_nb = NegativeBinomial(y, x, loglike_method='nb1').fit(start_params=[8, 0, 1], method='nm', maxiter=1000, 
                                    warn_convergence=False)
print(res_nb.summary())
sp = res_nb.params.copy()
sp[-1] = np.log(sp[-1])
res_nb = res_nb.model.fit(start_params=sp)
print(res_nb.summary())

The example has huge overdispersion alpha=1700, while the log(alpha) is then around 7.
The problem doesn't affect optimization much if alpha is around 1 or in another small range because the absolute mistake is not large. example is from mailing list link in #3476

Activity

  1. added this to the 0.9 milestone on Sep 21, 2017
  2. josef-pkt commented on Sep 21, 2017

    @josef-pkt
    MemberAuthor

    most likely I will fix this in a llnull PR that I am working on

  3. josef-pkt commented on Sep 21, 2017

    @josef-pkt
    MemberAuthor

    It looks like GeneralizedPoisson and NegativeBinomialP have the same problem, based on reading the code, no example yet.

    edit
    but in these two models transparams is False by default with a new keyword argument in fit
    use_transparams = False

  4. josef-pkt commented on Sep 21, 2017

    @josef-pkt
    MemberAuthor

    BUG, and transparams is never used in GPP, NBP

    both GeneralizedPoisson and NegativeBinomialP score have == instead of assignment =

    if self._transparams:
                score[-1] == score[-1] ** 2
    
  5. josef-pkt commented on Sep 22, 2017

    @josef-pkt
    MemberAuthor

    Fixed for NegativeBinomial in #3921, but not for GPP and NBP

  6. modified the milestones: 0.9, 0.15 on Dec 22, 2022
  7. bashtage commented on Jul 30, 2026

    @bashtage
    Member

    Fixed by PR #3921 (commit fe80d95), which transforms user-supplied start_params to log-alpha space when _transparams is active. The related score[-1] == score[-1] ** 2 no-op-comparison typo was separately fixed by commit 8f93160. Closing as fixed.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions