Closed dpastoor closed 7 months ago
Sorry for late reply on this. Feels like a bug. I'm guessing there is some neglect of the fact that you are starting at time = 4*7
or time = 2*7
in the event. The results look ok if you start this at time = 0
library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
realize_addl(ev(amt = 300, time = 4*7, ii = 4*7, until = 16*7))
#> Events:
#> time amt ii addl cmt evid
#> 1 28 300 0 0 1 1
#> 2 56 300 0 0 1 1
#> 3 84 300 0 0 1 1
#> 4 112 300 0 0 1 1
#> 5 140 300 0 0 1 1
realize_addl(ev(amt = 300, time = 0, ii = 4*7, until = 16*7))
#> Events:
#> time amt ii addl cmt evid
#> 1 0 300 0 0 1 1
#> 2 28 300 0 0 1 1
#> 3 56 300 0 0 1 1
#> 4 84 300 0 0 1 1
realize_addl(ev(amt = 300, time = 0, ii = 4*7, until = 16*7 + 0.001))
#> Events:
#> time amt ii addl cmt evid
#> 1 0 300 0 0 1 1
#> 2 28 300 0 0 1 1
#> 3 56 300 0 0 1 1
#> 4 84 300 0 0 1 1
#> 5 112 300 0 0 1 1
realize_addl(ev(amt = 300, time = 4*7, ii = 2*7, until = 16*7))
#> Events:
#> time amt ii addl cmt evid
#> 1 28 300 0 0 1 1
#> 2 42 300 0 0 1 1
#> 3 56 300 0 0 1 1
#> 4 70 300 0 0 1 1
#> 5 84 300 0 0 1 1
#> 6 98 300 0 0 1 1
#> 7 112 300 0 0 1 1
#> 8 126 300 0 0 1 1
#> 9 140 300 0 0 1 1
#> 10 154 300 0 0 1 1
realize_addl(ev(amt = 300, time = 0, ii = 2*7, until = 16*7))
#> Events:
#> time amt ii addl cmt evid
#> 1 0 300 0 0 1 1
#> 2 14 300 0 0 1 1
#> 3 28 300 0 0 1 1
#> 4 42 300 0 0 1 1
#> 5 56 300 0 0 1 1
#> 6 70 300 0 0 1 1
#> 7 84 300 0 0 1 1
#> 8 98 300 0 0 1 1
realize_addl(ev(amt = 300, time = 0, ii = 2*7, until = 16*7+0.001))
#> Events:
#> time amt ii addl cmt evid
#> 1 0 300 0 0 1 1
#> 2 14 300 0 0 1 1
#> 3 28 300 0 0 1 1
#> 4 42 300 0 0 1 1
#> 5 56 300 0 0 1 1
#> 6 70 300 0 0 1 1
#> 7 84 300 0 0 1 1
#> 8 98 300 0 0 1 1
#> 9 112 300 0 0 1 1
Created on 2024-01-10 with reprex v2.0.2
So workaround would be to start it at time = 0
and then offset the times?
realize_addl(ev(amt = 300, time = 0, ii = 2*7, until = 16*7)) %>%
mutate(time = time + 2*7)
#> Events:
#> time amt ii addl cmt evid
#> 1 14 300 0 0 1 1
#> 2 28 300 0 0 1 1
#> 3 42 300 0 0 1 1
#> 4 56 300 0 0 1 1
#> 5 70 300 0 0 1 1
#> 6 84 300 0 0 1 1
#> 7 98 300 0 0 1 1
#> 8 112 300 0 0 1 1
Created on 2024-01-10 with reprex v2.0.2
I am trying to leverage until to design dosing regimens up til a fixed point in time where we're done observing. To use this example, given monthly dosing until 16 weeks I used the following - however my expectation was dosing would stop at 84 (or maybe 112 aka 16 weeks), instead I see that it continues out to 140 which is
until + ii
but that doesn't seem to align with the definition ofI'm not following how for the q4w regimen there is 1 extra dose past 112, but then if q2w there is 3 extra doses?
Would appreciate some clarity on if i'm misunderstanding
until
's behavior?