ronkeizer / vpc

R library to create visual predictive checks (VPC)
Other
36 stars 20 forks source link

How to calculate the values of CL, Ka and Ke? #34

Closed gracertliu closed 7 years ago

gracertliu commented 7 years ago

Hi, In the function sim_data(), the parameter theta should be given such as cl, ka and ke. How to estimate these values? Dose the linear regression be a good tool for calculation? Need your comments. Thank you. Here is my code:

obs <- Theoph ke_i = rep(NA,12) ka_i = rep(NA,12) AUC_i = rep(NA,12) CL_i = rep(NA,12)

for(i in 1:12) {

Time point 4 to the end

if(i != 9) { x = obs[(4+11(i-1)):(11i),4] y = log(obs[(4+11(i-1)):(11i),5]) }

if(i == 9) { x = obs[(3+11(i-1)):(11i),4] y = log(obs[(3+11(i-1)):(11i),5]) }

y = a*x+b

lm.01 = lm(y~x) output = summary(lm.01)

b = output$coefficients[1] #Intercept a = output$coefficients[2] #Slope

beta = -a B = exp(b)

ke_i[i] = beta #Elimination rate

Extrapolation (Time point 1 to point 3)

if(i != 9) { x.1_3 = obs[(1+11(i-1)):(3+11(i-1)),4] y.1_3 = obs[(1+11(i-1)):(3+11(i-1)),5] }

if(i == 9) { x.1_3 = obs[(1+11(i-1)):(2+11(i-1)),4] y.1_3 = obs[(1+11(i-1)):(2+11(i-1)),5] } y.fit.1_3 = Bexp(-betax.1_3) Delta.Cpex = y.fit.1_3 - y.1_3

Time point 1 to point 3

y = a*x+b

y2 = log(Delta.Cpex) x2 = x.1_3

lm.02 = lm(y2~x2) output2 = summary(lm.02)

b2 = output2$coefficients[1] #Intercept a2 = output2$coefficients[2] #Slope

alpha = -a2 A = exp(b2)

ka_i[i] = alpha #Absorption rate

AUC

area = rep(NA,11)

for(j in 1:11) { x3 = obs[(1+11(i-1)):(11i),4] y3 = obs[(1+11(i-1)):(11i),5]

if(j < 11) area[j] = (y3[j+1]+y3[j])*(x3[j+1]-x3[j])/2 else
           area[j] = y3[j]/ke_i[i]

}

AUC_i[i] = sum(area)

Clearance

Dose = c(4.02, 4.40, 4.53, 4.40, 5.86, 4.00, 4.95, 4.53, 3.10, 5.50, 4.92, 5.30) dose = Dose[i] CL_i[i] = dose/AUC_i[i]

}

M = cbind(ka_i,ke_i,CL_i) M

Ke = mean(ke_i) Ka = mean(ka_i) AUC = mean(AUC_i) CL = mean(CL_i)

c(Ka,Ke,CL) round(cov(M),5)

ronkeizer commented 7 years ago

these parameters are best estimated using non-linear mixed-effects modeling. You can do that in R, but a more commonly-used tool in this field is NONMEM (or Monolix). You can also use Stan or BUGS, if you prefer a Bayesian approach.