Skip to content

neg_binomial_2_log_lpmf is not stable for large phi #1495

Closed
@martinmodrak

Description

@martinmodrak

Description

For some values, neg_binomial_2_log_lpmf would return values larger than 0 (e.g. neg_binomial_2_log_lpmf(39, 4, 6e16) == 256) for other, it just returns noticeably different values than the corresponding neg_binomial_2_lpmf call. In all cases this is related to large phi values (noticeable discrepancies manifest already at around phi = 2e5).

This seems to be related to/a regression of #428

Example

neg_binomial_2_log_lpmf(39, 4, 6e16) == 256.
I've created a failing test on the branch: develop...martinmodrak:bugfix/1495-neg_binomial_2_log_large_phi

Expected Output

The same as neg_binomial_2_lpmf(39, exp(4), 6e16), which is -5.22991

Current Version:

v3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions