epinowcast / epidist

An R package for estimating epidemiological delay distributions
http://epidist.epinowcast.org/
Other
9 stars 3 forks source link

Make test suite reproducible #130

Open athowes opened 6 days ago

athowes commented 6 days ago

Goal

This package includes testing of stochastic code. Primarily MCMC for Bayesian inference via Stan. It's challenging to include integration tests for such code. For example if the code produces some $p$-value, what is the right test threshold? And what can we do about the fact that the code, if working correctly, should always fail the test some proportion of the time?

The goal here is to mitigate this problem by at a minimum making the test suite reproducible by setting seeds. I don't know that this fully solves the problem but perhaps it's a step in the right direction. As an example of it not fully solving the problem, say we substitute in a new sampler or feature which changes how RNG is used. Then perhaps our tests fail, but the feature could not be a problem, it just got unlucky on the stochastic tests.

Required features

Out of scope

Related documents

seabbs commented 3 days ago

We can set temporary seeds inside test_that vs script wide which is probably the better bet. We can also directly give cmdstanr a seed if we wish (otherwise I think it inherits the R seed)