library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(PKPDmisc)
mod <- modlib("pk2", end = 36, delta = 0.05)
#> Building pk2 ...
#> done.
dose <- ev(amt = 100)
out <- mrgsim(mod, dose, output = "df")
summarise(
out,
Cmax = max(CP),
auc = auc_partial(time,CP),
auc_inf = auc_inf(time,CP)
)
#> Cmax auc auc_inf
#> 1 3.671298 68.80677 99.99051
dose$amt/mod$CL
#> [1] 100
mod <- modlib("popex", end = 24, delta = 1)
#> Building popex ... done.
dose <- ev(amt = 100, ID = 1:10)
out <- mrgsim(mod, dose, output = "df")
summarise(
group_by(out,ID),
Cmax = max(DV),
auc = auc_partial(time,DV),
auc_inf = auc_inf(time,DV)
)
#> # A tibble: 10 x 4
#> ID Cmax auc auc_inf
#> <dbl> <dbl> <dbl> <dbl>
#> 1 1 1.97 37.9 75.8
#> 2 2 5.37 81.8 115.
#> 3 3 4.14 44.7 47.7
#> 4 4 2.67 47.4 65.9
#> 5 5 3.00 44.4 56.7
#> 6 6 1.85 36.2 83.6
#> 7 7 1.28 23.2 320.
#> 8 8 2.41 45.8 87.1
#> 9 9 4.17 77.9 126.
#> 10 10 3.78 64.2 95.7
Created on 2020-04-04 by the reprex package (v0.3.0)