**Wiekvoet**, and kindly contributed to R-bloggers)

In this third PK posting I move to chapter 10, study problem 4 of Rowland and Tozer (Clinical pharmacokinetics and pharmacodynamics, 4th edition). In this problem one subject gets a 24 hours continuous dose. In many respects the Jags calculation is not very different from before, but the relation between parameters in the model and PK parameters is a bit different.

### Data

Data is from infusion at constant rate, (1.5 µm/hr, but the calculations come out on the expected values with 1.5 µg/hr, and no molecular weight is given in the question) for 24 hours. Drug concentration (µg/L) in plasma is measured for 28 hours.

ch10sp4 <- data.frame(

time=c(0,1,2,4,6,7.5,10.5,14,18,24,25,26,27,28),

conc=c(0,4.2,14.5,21,23,19.8,22,20,18,21,18,11.6,7.1,4.1))

### Model

The model is straightforward, but does suffer a bit from sensitivity of init values. The construction (time<24 and time>=24 is just a quick way to ensure that the up and down doing parts of the model sit at the correct spots in time.

library(R2jags)

datain <- as.list(ch10sp4)

datain$n <- nrow(ch10sp4)

datain$Rinf <- 1.5*1000

model1 <- function() {

for (i in 1:n) {

pred[i] <- Css*((1-exp(-k*time[i]))*(time[i]<24)

+exp(-k*(time[i]-24))*(time[i]>=24))

conc[i] ~ dnorm(pred[i],tau)

}

tau <- 1/pow(sigma,2)

sigma ~ dunif(0,100)

Css <- Rinf/CL

k <- CL/V

V ~ dlnorm(2,.01)

CL ~ dlnorm(1,.01)

t0_5 <- log(2)/k

Cssalt <- 3000/CL

h1 <- Cssalt*(1-exp(-k))

h2 <- Cssalt*(1-exp(-2*k))

CLpermin <- CL/60

}

parameters <- c(‘k’,’CL’,’V’,’t0_5′,’Cssalt’,’h1′,’h2′,’Css’,’CLpermin’)

inits <- function()

list(V=rlnorm(1,log(100),.1),CL=rlnorm(1,log(70),.1),sigma=rlnorm(1,1,.1))

jagsfit <- jags(datain, model=model1,

inits=inits,

parameters=parameters,progress.bar=”gui”,

n.chains=4,n.iter=14000,n.burnin=5000,n.thin=2)

jagsfit

Expected values: CL=1.2 L/min, t_{1/2}=1.6 hr, V=164 L. The values are a bit off, it was given in the text that Css is 21 mg/L while the model finds 22.

Three additional parameters; Cssalt, h1, h2 correspond to part (c) of the question; what concentrations if the dosage is doubled. Expected answers: Cssalt=42, h1=14.8, h2=24.

#### Plot of the model

#### part (b) Is the curve in the up and down going part equally steep?

This requires a different model, since right now by definition they are equally shaped. The parameter k12, difference between k1 and k2, is the parameter of interest.

datain2 <- as.list(ch10sp4)

datain2$n <- nrow(ch10sp4)

model2 <- function() {

for (i in 1:n) {

pred[i] <- Css*((1-exp(-k1*time[i]))*(time[i]<24)

+exp(-k2*(time[i]-24))*(time[i]>=24))

conc[i] ~ dnorm(pred[i],tau)

}

tau <- 1/pow(sigma,2)

sigma ~ dunif(0,100)

k1 ~ dlnorm(0,0.001)

k2 ~ dlnorm(0,0.001)

Css ~ dnorm(21,.01)

k12 <- k1-k2

}

parameters2 <- c(‘k1′,’k2′,’k12′,’Css’)

jagsfit2 <- jags(datain2, model=model2,

parameters=parameters2,progress.bar=”gui”,

n.chains=4,n.iter=14000,n.burnin=5000,n.thin=2)

n.sims = 18000 iterations saved

mu.vect sd.vect 2.5% 25% 50% 75% 97.5% Rhat n.eff

Css 21.275 1.131 19.089 20.559 21.258 21.982 23.578 1.001 6800

k1 0.529 0.138 0.333 0.446 0.512 0.588 0.814 1.002 8300

k12 0.194 0.163 -0.074 0.099 0.182 0.272 0.520 1.015 3800

k2 0.334 0.068 0.215 0.291 0.329 0.374 0.480 1.001 8600

deviance 64.761 3.663 60.215 62.073 63.929 66.528 73.979 1.002 3900

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 = 6.7 and DIC = 71.5

DIC is an estimate of expected predictive error (lower deviance is better).

### Previous posts in this series:

Simple Pharmacokinetics with Jags

**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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...