stan-dev / stan-dev/math

student_t_cdf returning 0.0 when should be returning actual value

Open
#3,234 0 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

Hi, it appears student_t_cdf() returns 0.0 in cases where it shouldn't.
I have attached session output showing mismatched values - p-values using student_t_cdf() against R's t.test. Most match almost exactly but where they do not, student_t_cdf() appears to return exactly 0.0 rather than a computed value.

I have attached session output and a self-contained example (just source this into R). I hope it's not a coding mistake on my part, don't think so.

thanks
Fraser

output.txt

issue_git_R.txt

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 sourcing issue_git_R.txt in R and comparing its student_t_cdf() results with the attached output.txt and R's t.test values. Then locate the student_t_cdf() implementation and determine why some cases return exactly 0.0; the fix is done when those cases produce the expected nonzero values and the regression is covered by the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, r
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.