evid_() is a model-only function that schedules a future dosing or
observation event during ODE solving. It is evaluated at each output
time point and inserts the requested event into the individual's event
timeline for future processing.
This function has no meaning outside an rxode2 model block and will throw an error if called directly from R.
Arguments
- time
Numeric. The time at which the event should occur. Must be greater than the current model time
t; events in the past are silently counted and a warning is issued after solving.- evid
Integer event ID. Follows NONMEM/rxode2 conventions:
0Observation (adds an output row, no dose).
1Dose (bolus or infusion depending on
rate).2Other type observation (passed through).
3Reset all compartments.
4Reset then dose.
5Replace compartment amount.
6Multiply compartment amount.
7Phantom/transit dose.
>= 100Classic rxode2 internal evid; passed through verbatim.
- amt
Numeric dose amount (for dose events) or
0for observations. Whenrate > 0this is interpreted as the total infusion amount and the infusion duration isamt / rate.- cmt
Integer compartment number (1-based) to which the dose is applied. Default is 1
- rate
Numeric infusion rate.
0Bolus dose (default).
> 0Fixed infusion rate; duration =
amt / rate.-1Rate defined by the model (
rate_<cmt>variable).-2Duration defined by the model (
dur_<cmt>variable).
- ii
Numeric inter-dose interval. Used together with
addlto schedule repeat doses attime,time + ii,time + 2*ii, ...,time + addl*ii. Also required whenss > 0. Default 0- addl
Integer number of additional doses beyond the first. The total number of doses pushed is
addl + 1, spacediiapart. Each dose is pushed as a standalone event (not as a periodic schedule in the event table).- ss
Integer steady-state flag applied to the first dose only (
addlrepetitions always usess = 0).0No steady-state (default).
1Steady-state additive: add SS solution to current state.
2Steady-state replace: replace current state with SS solution.
Value
This function is only meaningful inside an rxode2 model; it
returns NULL invisibly if called from R directly (after signaling
an error).
Details
Behavior inside a model
evid_() is evaluated at every output time point (when the solver is
exactly at a scheduled event time). The pushed event is inserted into
the individual's event timeline and the solver visits it at the
specified future time.
The number of events that may be pushed per individual is limited by
the maxExtra argument of rxSolve(). When maxExtra = 0
(the default) there is no limit. Exceeding the limit causes an
error.
Past-time pushes (where time <= t) are silently ignored and counted;
a warning is issued after solving.
See also
rxSolve() for the maxExtra control argument.
Examples
# \donttest{
# Push a single bolus of 50 mg to compartment 1 at t + 12
m <- rxode2({
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl / vd * central
cp <- central / vd
if (t < 24) {
evid_(t + 12, 1, 50, 1, 0, 0, 0, 0)
}
})
#>
#>
# Push three boluses (addl = 2) at t+6, t+18, t+30 (ii = 12)
m2 <- rxode2({
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl / vd * central
cp <- central / vd
if (t < 1) {
evid_(t + 6, 1, 50, 1, 0, 12, 2, 0)
}
})
#>
#>
# }
