Skip to content

Conversation

@devmotion
Copy link
Member

When working on adding a new distribution, I realized (once again) that the R test references can't be re-generated currently since running Rscript gendref.R errors:

  • The LindleyR package is not available anymore
  • For distr = StudentizedRange(...) since the function distr$pdf is undefined
  • truncated(Normal(...), ...) is not a valid reference name as it can't be mapped to a reference distribution

Moreover, after commenting out these three reference distribution types rerunning Rscript gendref.R changes reference values for most distributions.


This PR tries to fix the setup of the R reference tests:

  • Use renv for a reproducible package environment
  • Add a GHA that updates the R environment and reference values (scheduled and manually)
  • Replace LindleyR with new.dist
  • Use explicit package::function syntax instead of relying on library(package) in other source files
  • Calculate (log)pdf reference values of StudentizedRange by finite differencing of (log)cdf
  • Allow manual specification of distr$dtype and distr$expr (to support truncated(...) properly)
  • Simplify matrix-variate data generation by using StanHeaders instead of rstan
  • Improve definition of reference distributions for alternative Julia distribution types (e.g. Erlang and NormalCanon)
  • Update test/ref/readme.md
  • Update reference values by running Rscript gendref.R

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.37%. Comparing base (3d304c2) to head (dd2a0cc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2007      +/-   ##
==========================================
- Coverage   86.44%   86.37%   -0.07%     
==========================================
  Files         147      147              
  Lines        8837     8837              
==========================================
- Hits         7639     7633       -6     
- Misses       1198     1204       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines -8 to +9
"X": [1.80115497975516, 1.39357092294611, 0.679396397136899, 1.39357092294611, 1.32682592836847, 0.624106043062951, 0.679396397136899, 0.624106043062951, 0.431228950208813],
"lpdf": [-0.598439090738466]
"X": [0.48516264401941139, 0.21974036159989954, -0.13995828882732522, 0.21974036159989954, 0.28855250002048116, -0.23735060033573027, -0.13995828882732522, -0.23735060033573027, 0.61858504476347143],
"lpdf": [-0.092239036945123282]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this was incorrect before?

@@ -339,16 +336,15 @@
"skewness": "nan"
},
"points": [
{ "x": -1.2, "pdf": 0, "logpdf": "-inf", "cdf": 0 },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why this line and others disappear?


on:
schedule:
- cron: '00 00 * * *'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running this once per month or week would probably be enough? It hasn't been run for years. ;-)

BTW, if it fails, will we be notified (e.g. with an issue)? Otherwise it could fail silently for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants