Como-DTC-Collaboration / comoDTC

An R package allowing easy access to the Como Covid-19 simulation model
Other
1 stars 0 forks source link

Minimal run of original package for testing #29

Open fcooper8472 opened 3 years ago

fcooper8472 commented 3 years ago

Since we're creating a new version of the R package that's more modular, we ideally need to check that nothing goes wrong in the conversion process.

The ideal situation, I think, is to create a minimal working example from the original package that generates some results. We then run the exact same test with our version of the package, and check that we get the same results.

DSeiferth commented 3 years ago

What do you consider a minimal working example?

The minimal example should probably run Ben's initial simulation script, shouldn't it? https://github.com/ben18785/comoOdeCpp/blob/ben-playing-1/src/s_initial.Rmd

What results shall be compared? "only" the output of the following call? out_cpp <- ode(y = Y, times = times, method = "euler", hini = 0.05, func = covidOdeCpp, parms = parameters, ...)

ben18785 commented 3 years ago

@DSeiferth thanks. Hmm, I suppose we might actually want a selection of runs to test against? Are there any existing tests in the /tests folder that run through a range of scenarios? If not, I'd say that having a few different runs for different combinations of:

might make sense. What do you think? Ultimately, if we could think of some way of automating this testing process so that we could flexibly compare our implementation with theirs, that'd be great but may be harder.

DSeiferth commented 3 years ago

In the folder "tests/testthat/" there are a few automated tests:

I will have a closer look at them and on unit-testing in R in general. But I don't want to promise too much because my understanding of the package is quite limited and the R syntax is new to me.

devtools::test()

ben18785 commented 3 years ago

In the meeting, we agreed that we would create a function that allows you to run the old package with parameter values as input.

I'm guessing this function would likely sit in the ben18785/comoOdeCpp repo? To compare old vs new simulation runs, we could then just install the "comoDTC" library in (say) a script in the ben18785/comoOdeCpp repo, then just run simulations side by side...

bogaotory commented 3 years ago

@DSeiferth Out of all the tests in tests/testthat/ the one closest to this issue is this one I had the same issue when translating the R version of the ODE to a Cpp version, and this test allows me to compare the output between the two versions.

DSeiferth commented 3 years ago

Thanks @bogaotory!