stan-dev / stan-dev/math

Add `log_inc_beta` function

Open
#2,790 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

The Binomial (LC)CDF functions are defined using the inc_beta function, however this can underflow to 0 for large inputs. By using the relationship with the Gauss Hypergeometric function, we can calculate inc_beta on the log scale: https://stats.stackexchange.com/a/148700

This provides greater resistance to underflow: https://godbolt.org/z/Pxn8MMYTv

Current Version:

v4.4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing inc_beta implementation and the Binomial (LC)CDF functions mentioned in the issue. Read the linked Gauss Hypergeometric relationship and compare it with the underflow example; done means a log_inc_beta function provides the requested large-input behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.