Skip to content

Commit

Permalink
Add example 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Sep 12, 2024
1 parent d580ab8 commit e988c71
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions inst/poped/ex.2.a.warfarin.evaluate.babelmixr2.R
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)

0 comments on commit e988c71

Please sign in to comment.