Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 1.99 KB

parallel.md

File metadata and controls

102 lines (73 loc) · 1.99 KB

Parallel zero-/first-order absorption

library(dplyr)
library(mrgsolve)

PK model

  • One-compartment (CENT), with absorption / depot compartment (GUT)
  • We want to administer a single dose, with a certain fraction as a a zero-order infusion and the remaining fraction by first order absorption
  • To split to dose, we use the bioavailability parameter for GUT and CENT (F_GUT and F_CENT, respectively) and we specify the duration of the infusion with D_CENT.
code <- '
$PARAM CL = 1, V = 20, KA = 1.1
frac_infusion = 0.37, dur_infusion = 10

$PKMODEL cmt = "GUT CENT", depot = TRUE

$MAIN

D_CENT = dur_infusion;
F_CENT = frac_infusion;
F_GUT =  1-frac_infusion;

$TABLE
capture CP = CENT/V;
'
mod <- mcode("parallel", code) %>% update(end = 48, delta = 0.1)

Parallel zero-/first-order

  • We have 100 mg total dose
  • We will need an event object (or data set) with two dosing records, giving the full dose on each record every time we want to administer a dose
infusion <- ev(amt = 100, cmt = "CENT", rate = -2)

zero <- mutate(infusion, cmt = "GUT", rate= 0)

dose <- c(infusion, zero)

dose
. Events:
.   time amt rate  cmt evid
. 1    0 100   -2 CENT    1
. 2    0 100    0  GUT    1

Result

out <- mrgsim_e(mod, dose)
plot(out, GUT + CP ~time)

Show individual components

Let’s set up a simulation where we have 3 subjects: one gets the infusion (only; blue line), one gets the depot dose (only; pink line) and the other gets both (green line):

data <- as_data_set(infusion, zero, dose)

data
.   ID time  cmt evid amt rate
. 1  1    0 CENT    1 100   -2
. 2  2    0  GUT    1 100    0
. 3  3    0 CENT    1 100   -2
. 4  3    0  GUT    1 100    0
mrgsim_d(mod,data) %>% plot(GUT+CP~time)