Distributions.jl
Distributions.jl copied to clipboard
Fix R test references and make them reproducible
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
LindleyRpackage is not available anymore - For
distr = StudentizedRange(...)since the functiondistr$pdfis 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
renvfor a reproducible package environment - Add a GHA that updates the R environment and reference values (scheduled and manually)
- Replace
LindleyRwithnew.dist - Use explicit
package::functionsyntax instead of relying onlibrary(package)in other source files - Calculate (log)pdf reference values of
StudentizedRangeby finite differencing of (log)cdf - Allow manual specification of
distr$dtypeanddistr$expr(to supporttruncated(...)properly) - Simplify matrix-variate data generation by using
StanHeadersinstead ofrstan - Improve definition of reference distributions for alternative Julia distribution types (e.g.
ErlangandNormalCanon) - Update test/ref/readme.md
- Update reference values by running
Rscript gendref.R
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 86.29%. Comparing base (bbdd4f1) to head (9d75f78).
Additional details and impacted files
@@ Coverage Diff @@
## master #2007 +/- ##
==========================================
- Coverage 86.35% 86.29% -0.07%
==========================================
Files 146 146
Lines 8782 8782
==========================================
- Hits 7584 7578 -6
- Misses 1198 1204 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.