Merck / simtrial

Clinical trial simulation for time-to-event endpoints
https://merck.github.io/simtrial/
GNU General Public License v3.0
18 stars 8 forks source link

add sample size and events to `sim_gs_n` per analysis per simulation #208

Closed LittleBeannie closed 8 months ago

LittleBeannie commented 8 months ago

Closes #207

LittleBeannie commented 8 months ago

Instead of removing n and event from observed, I think the better way to update the tests is to add these to expected.

Agreed! I'm uncertain about the origin of the "magic number" in the expected . I will reach out to John and inquire about the feasibility of including n (sample size) and event (number of events) in the expected object of test-unvalidated-sim_gs_n.R.

Hi @jdblischak, could you please let us know if it is possible to incorporate n and event in the expected object of the test-unvalidated-sim_gs_n.R?

jdblischak commented 8 months ago

if it is possible to incorporate n and event in the expected object of the test-unvalidated-sim_gs_n.R?

@LittleBeannie Yes, I obtained expected by running constructive::construct(observed)

I'm uncertain about the origin of the "magic number" in the expected .

These are backwards compatibility tests. There is nothing magic about them. I cannot refactor the code without having tests to ensure I don't break anything.

LittleBeannie commented 8 months ago

if it is possible to incorporate n and event in the expected object of the test-unvalidated-sim_gs_n.R?

@LittleBeannie Yes, I obtained expected by running constructive::construct(observed)

I'm uncertain about the origin of the "magic number" in the expected .

These are backwards compatibility tests. There is nothing magic about them. I cannot refactor the code without having tests to ensure I don't break anything.

Thank you for your quick response! I encountered an issue while attempting to run constructive::construct(observed) directly in the console. It seems that I might have missed the correct way to run the code. Could you please help update the expected?

jdblischak commented 8 months ago

Could you please help update the expected?

Done in https://github.com/Merck/simtrial/pull/208/commits/f815bbca4211de9ed05ad0364b124db55f99cb99

I encountered an issue while attempting to run constructive::construct(observed) directly in the console. It seems that I might have missed the correct way to run the code.

It's probably because we recently moved all the setup code to helper functions. To be able to use these, you have to first run devtools::load_all(".") in the console (Ctrl-Shift-L in RStudio). Annoyingly running devtools::test() in the console removes the helper functions, so you have to re-run devtools::load_all(".") to be able to return to interactive troubleshooting.