RobinDenz1 / simDAG

An R-Package to Simulate Simple and Complex (longitudinal) Data from a DAG and Associated Node Information
https://robindenz1.github.io/simDAG/
GNU General Public License v3.0
9 stars 0 forks source link

Immunity not preventing additional events from happening #3

Closed zterner-mitre closed 9 months ago

zterner-mitre commented 9 months ago

Hi Robin, simDAG - waning vax - Git - immunity bug.txt

In the attached R script, I have set the immunity for my vaccination node to be Inf. But there are many cases where people get vaccinated more than once.

I have found a workaround for this issue, but I wanted to bring your attention to the issue in the code anyway.

For reference, here is the specification of the model. (It's also in the code of course but thought it might help to show it here.)

image

That image doesn't show the prob functions for the other nodes, but those are in the code, and I don't see why those should be contributing to people getting vaccinated more than once.

Again, it's easy enough to fix this -- an fifelse to prevent people from getting vaccinated based on the time_since_last works fine -- but wanted you to know that immunity may not be functioning as intended.

RobinDenz1 commented 9 months ago

Thank you for your report. This is indeed a bug in the node_time_to_event() function. I will push an update resolving this bug to github in a minute.