resplab / epicR

R package for the Evaluation Platform in COPD (EPIC), an agent-based whole-disease model for projection of health and economic outcomes and COPD interventions.
11 stars 11 forks source link

Add option to begin case detection after X years #121

Closed rachaelmountain closed 2 years ago

rachaelmountain commented 2 years ago

I need to begin the budget impact analysis in 2021. Can the case detection module be "switched on" based on local time (e.g. using an if statement) so that we're still simulating the 2015-2020 period with no case detection?

Priority: medium

aminadibi commented 2 years ago

So, I attempted this by adding a settings$record_from_year parameter and resetting output() and output_ex() in the annual event whenever settings.record_from_year>floor((*ag).local_time). Turns out it's a bad idea and will cause an infinite loop, as epic uses n_base_agent in the output to end the run.

aminadibi commented 2 years ago

For some reason the same approach fails to reset output_ex. Strange

aminadibi commented 2 years ago

Resetting output_ex in event fixed works, but increases run time by a factor of 4!

rachaelmountain commented 2 years ago

Increases run time by a factor of 4 compared to storing all the years' data? Then I don't think it's entirely necessary to reset output_ex in the annual event. As long as we have the figures I need reported annually and we can control the case detection module through p_case_detection as a vector, what's the benefit of resetting output_ex?

aminadibi commented 2 years ago

I guess we can leave it as is then @KateJohnson @rachaelmountain Otherwise, I've added vactorized case_detection probability. Please test and let me know if it works as expected.

rachaelmountain commented 2 years ago

Tested. Working as expected. Thank you!

aminadibi commented 2 years ago

Excellent