-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d580ab8
commit e988c71
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
## Warfarin example from software comparison in: | ||
## Nyberg et al., "Methods and software tools for design evaluation | ||
## for population pharmacokinetics-pharmacodynamics studies", | ||
## Br. J. Clin. Pharm., 2014. | ||
|
||
library(babelmixr2) | ||
library(PopED) | ||
|
||
##-- Model: One comp first order absorption | ||
|
||
f <- function() { | ||
ini({ | ||
tCl <- 0.15 | ||
tV <- 8 | ||
tKA <- 1.0 | ||
tFavail <- fix(1) | ||
eta.cl ~ 0.07 | ||
eta.v ~ 0.02 | ||
eta.ka ~ 0.6 | ||
|
||
prop.sd <- sqrt(0.01) | ||
}) | ||
model({ | ||
CL <- tCl*exp(eta.cl) | ||
V <- tV*exp(eta.v) | ||
KA <- tKA*exp(eta.ka) | ||
Favail <- tFavail | ||
y <- (DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*time)-exp(-KA*time)) | ||
y ~ prop(prop.sd) | ||
|
||
}) | ||
} | ||
|
||
e <- et(list(c(0, 120))) %>% | ||
et(c(1,2,6,24,36,72,120)) | ||
|
||
e$time <- c(0.5,1,2,6,24,36,72,120) | ||
e$low <- 0 | ||
e$high <- 120 | ||
|
||
e <- as.data.frame(e) | ||
|
||
## -- Define initial design and design space | ||
babel.db <- nlmixr2(f, e, "poped", | ||
control=popedControl( | ||
groupsize=32, | ||
a=list(c(DOSE=70)))) | ||
|
||
## create plot of model without variability | ||
plot_model_prediction(babel.db) | ||
|
||
## create plot of model with variability | ||
plot_model_prediction(babel.db,IPRED=T,DV=T) | ||
|
||
## get predictions from model | ||
model_prediction(babel.db) | ||
|
||
## evaluate initial design | ||
evaluate_design(babel.db) | ||
shrinkage(babel.db) | ||
|
||
## Evaluate with full FIM | ||
evaluate_design(babel.db, fim.calc.type=0) | ||
|
||
# Examine efficiency of sampling windows | ||
plot_efficiency_of_windows(babel.db,xt_windows=0.5) |