Learn R Programming

mrgsolve (version 0.8.9)

events: Event objects for simulating PK and other interventions.

Description

Events can either be specified when the model object is created (with mrgmod) or by updating an existing model object (with update).

Usage

events(x, ...)

ev(x, ...)

as.ev(x, ...)

# S4 method for mrgmod events(x, ...)

# S4 method for mrgmod ev(x, object = NULL, ...)

# S4 method for missing ev(time = 0, evid = 1, ID = numeric(0), cmt = 1, replicate = TRUE, until = NULL, realize_addl = FALSE, ...)

# S4 method for ev ev(x, realize_addl = FALSE, ...)

# S4 method for data.frame as.ev(x, nid = 1, keep_id = TRUE, ...)

# S4 method for ev as.ev(x, ...)

# S4 method for ev as.matrix(x, ...)

# S4 method for ev as.data.frame(x, row.names = NULL, optional = FALSE, ...)

# S4 method for ev show(object)

# S4 method for mrgsims events(x, ...)

Arguments

x

mrgmodel object

...

passed on

object

passed to show

time

event time

evid

event ID

ID

subject ID

cmt

compartment

replicate

logical; if TRUE, events will be replicated for each individual in ID

until

the expected maximum observation time for this regimen

realize_addl

if FALSE (default), no change to addl doses. If TRUE, addl doses are made explicit with realize_addl.

nid

if greater than 1, will expand to the appropriate number of individuals

keep_id

if TRUE, ID column is retained if it exists

row.names

passed to as.data.frame

optional

passed to as.data.frame

Value

Returns a user-defined data frame of events that should be suitable for passing into lsoda. If events are stored as a data frame, events returns the data frame. If events are stored as a function that generates the data frame, events calls the function and passes return back to the user.

events object

Details

  • Required input for creating events objects include time and cmt

  • If not supplied, evid is assumed to be 1.

  • If not supplied, cmt is assumed to be 1.

  • If not supplied, time is assumed to be 0.

  • ID may be specified as a vector.

  • If replicate is TRUE (default), thenthe events regimen is replicated for each ID; otherwise, the number of event rows must match the number of IDs entered

Examples

Run this code
# NOT RUN {
mod <- mrgsolve:::house()
mod <- mod %>% ev(amt=1000, time=0, cmt=1)
events(mod)

loading <- ev(time=0, cmt=1, amt=1000)
maint <- ev(time=12, cmt=1, amt=500, ii=12, addl=10)
loading + maint


ev(ID=1:10, cmt=1, time=0, amt=100)


# }

Run the code above in your browser using DataLab