**Wiekvoet**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Chapter 19 of Rowland and Tozer (Clinical pharmacokinetics and pharmacodynamics, 4th edition) has distribution kinetics. I am examining problem 3. It is fairly easy, especially since essentially all formulas are on the same page under ‘key relationships’. The only difficulty is that the formulas are symmetrical in λ_{1}, c_{1} and λ_{2}, c_{2 }and they are exchanged between chains. For this I forced λ_{1}>λ_{2}. In addition, I do not really believe concentrations in the 4000 range are as accurately measured as those in the 5 range (in the period 1/2 hour to 1 hour, the decrease is about 80 units per minute). The measurement error is now proportional to concentration.

### 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

### Plot

### Previous posts in this series:

Simple Pharmacokinetics with Jags

PK calculations for infusion at constant rate

**leave a comment**for the author, please follow the link and comment on their blog:

**Wiekvoet**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.