Data and model
C19SP3 <- data.frame(time=c(0.5,1,1.5,2,3,4,5,8,12,16,24,36,48),
conc=c(4211,1793,808,405,168,122,101,88,67,51,30,13,6))
library(R2jags)
datain <- list(
time=C19SP3$time,
lconc=log(C19SP3$conc),
n=nrow(C19SP3),
dose=30*1000)
model1 <- function() {
tau <- 1/pow(sigma,2)
sigma ~ dunif(0,100)
llambda1 ~dlnorm(.4,.1)
cc1 ~ dlnorm(1,.01)
llambda2 ~dlnorm(.4,.1)
cc2 ~ dlnorm(1,.01)
choice <- llambda1>llambda2
c1 <- choice*cc1+(1-choice)*cc2
c2 <- choice*cc2+(1-choice)*cc1
lambda1 <- choice*llambda1+(1-choice)*llambda2
lambda2 <- choice*llambda2+(1-choice)*llambda1
for (i in 1:n) {
pred[i] <- log(c1*exp(-lambda1*time[i]) +c2*exp(-lambda2*time[i]))
lconc[i] ~ dnorm(pred[i],tau)
}
V1 <- dose/(c1+c2)
AUC <- c1/lambda1+c2/lambda2
CL <- dose/AUC
V <- CL/lambda2
Vss <- dose*(c1/pow(lambda1,2)+c2/pow(lambda2,2))/pow(AUC,2)
}
parameters <- c('c1','c2','lambda1','lambda2' ,
'V1','CL','Vss','AUC','V')
inits <- function()
list(
sigma=rnorm(1,1,.1),
cc1=9000,
cc2=150)
jagsfit <- jags(datain, model=model1,
inits=inits,
parameters=parameters,progress.bar="gui",
n.chains=4,n.iter=14000,n.burnin=5000,n.thin=2)
Results
Results same as in the book:
Inference for Bugs model at "C:\...5a.txt", fit using jags,
4 chains, each with 14000 iterations (first 5000 discarded), n.thin = 2
n.sims = 18000 iterations saved
mu.vect sd.vect 2.5% 25% 50% 75% 97.5% Rhat n.eff
AUC 7752.778 130.145 7498.102 7670.443 7751.138 7831.068 8016.879 1.002 3000
CL 3.871 0.065 3.742 3.831 3.870 3.911 4.001 1.002 3000
V 57.971 1.210 55.650 57.215 57.956 58.708 60.401 1.002 4000
V1 2.980 0.104 2.776 2.915 2.978 3.044 3.192 1.002 2800
Vss 18.038 0.600 16.865 17.662 18.029 18.404 19.251 1.002 3900
c1 9933.578 352.138 9253.229 9709.652 9927.037 10145.611 10659.610 1.002 2800
c2 147.197 2.412 142.333 145.734 147.207 148.659 152.069 1.001 5000
lambda1 1.790 0.028 1.734 1.772 1.790 1.807 1.847 1.002 2800
lambda2 0.067 0.001 0.065 0.066 0.067 0.067 0.068 1.001 10000
deviance -59.366 4.394 -65.150 -62.608 -60.275 -57.058 -48.524 1.001 4100
For each parameter, n.eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
DIC info (using the rule, pD = var(deviance)/2)
pD = 9.6 and DIC = -49.7
DIC is an estimate of expected predictive error (lower deviance is better).
Plot
The plot has narrow intervals, which is a reflection of the small intervals in the parameters.
Previous posts in this series:
Simple Pharmacokinetics with Jags
PK calculation of IV and oral dosing in JAGS Translated in Stan by Bob Carpenter here: Stan Model of the Week: PK Calculation of IV and Oral Dosing
PK calculations for infusion at constant rate
PK calculations for infusion at constant rate
No comments:
Post a Comment