Simulation PopPK / PKPD
Utilisez le modèle guidé en temps réel, ou modifiez un code mrgsolve libre et exportez un flux reproductible R, Rmd et CSV.
Spaghetti + bandes (p5/p50/p95)
Rouge = observations simulées (DV), bande bleue = préditesAUC médiane30.8
Cmax médiane3.79
Tmax médiane2.00 h
Code R de reproduction
# Generated by PMx Explain - Simulation
# Model structure, population variability and residual error are explicit below.
library(mrgsolve)
set.seed(7)
n_subjects <- 80
dose <- 200
t_end <- 24
sampling_times <- c(0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15, 15.5, 16, 16.5, 17, 17.5, 18, 18.5, 19, 19.5, 20, 20.5, 21, 21.5, 22, 22.5, 23, 23.5, 24)
model_code <- paste(c(
"$PARAM TVCL=6, TVVC=40, TVKA=1.2, TVQ1=5, TVVP1=60, TVQ2=3, TVVP2=80, LAG=0.5, KTR=2.66666666667, ETA_CL=0, ETA_VC=0, ETA_KA=0, ETA_Q1=0, ETA_VP1=0, ETA_Q2=0, ETA_VP2=0, KAPPA_CL=0",
"$CMT GUT CENT",
"$MAIN",
"double CL = TVCL*exp(ETA_CL + KAPPA_CL);",
"double VC = TVVC*exp(ETA_VC);",
"double KA = TVKA*exp(ETA_KA);",
"$ODE",
"dxdt_GUT = -KA*GUT;",
"dxdt_CENT = KA*GUT - (CL)*CENT/VC;",
"$SIGMA 0.04 0.04",
"$TABLE",
"double IPRED = CENT/VC;",
"double DV = fmax(0.0, IPRED*(1.0 + EPS(1)) + EPS(2));",
"$CAPTURE IPRED DV CL VC KA"
), collapse = "\n")
mod <- mcode("poppk_simulation", model_code)
idata <- data.frame(
ID = seq_len(n_subjects),
ETA_CL = rnorm(n_subjects, 0, 0.3),
ETA_VC = rnorm(n_subjects, 0, 0.3),
ETA_KA = rnorm(n_subjects, 0, 0.2),
ETA_Q1 = rnorm(n_subjects, 0, 0.2),
ETA_VP1 = rnorm(n_subjects, 0, 0.2),
ETA_Q2 = rnorm(n_subjects, 0, 0.2),
ETA_VP2 = rnorm(n_subjects, 0, 0.2),
KAPPA_CL = rnorm(n_subjects, 0, 0)
)
dose_event <- ev(amt = dose, cmt = "GUT")
grid <- tgrid(0, t_end, delta = max(t_end / 500, 0.01), add = sampling_times)
mod <- idata_set(mod, idata)
mod <- ev(mod, dose_event)
simulation <- as.data.frame(mrgsim(mod, tgrid = grid))
keep <- vapply(simulation$time, function(value) any(abs(value - sampling_times) < 1e-8), logical(1))
columns <- c("ID", "time", "IPRED", "DV", "CL", "VC", "KA")
simulation <- simulation[keep, columns]
simulation <- simulation[!duplicated(simulation[c("ID", "time")], fromLast = TRUE), ]
write.csv(simulation, "poppk_simulation_R.csv", row.names = FALSE)
simulation
Explorer la distribution et l'accumulation dans les laboratoires animes