- #1
lavoisier
- 177
- 24
I wonder if anyone can please help / point me to some info on how to solve this problem. I posted the same question on another website, and so far there is no conclusive answer.
I have some pharmacokinetic data for a molecule that was administered in rat, first IV (intra-venously), then PO (orally). The data are in both cases of the form (time,concentration).
I fit (in R) a first model using the IV data, obtaining estimates for parameters 'CL' and 'V'. Then I fit a second model using the PO data, obtaining estimates for parameters 'ka' and 'F'.
The crucial aspect that is causing all the trouble is that the second model uses the best estimate of CL and V obtained from the first model, but in my implementation the variances of CL and V, calculated when I run the first model, do not enter in any way in the second model, which sounds wrong to me.
Also, the fitting package I am using (FME) calculates the covariance matrix, which I need for other calculations, but of course as this matrix is made only for the modifiable parameters of each model, the one obtained from the second model does not have CL and V in it. But I need to know the covariance between the IV parameters and PO parameters.
I asked a colleague at work, and she suggested to run a single model with all 4 parameters (CL, V, ka, F), where the residuals are calculated using both the IV and PO data.
This is possible in FME, by using two distinct dependent variables, and probably a good idea in general, except that I specifically need: A) CL and V to be regressed only using the IV data, and B) ka and F only using the PO data. "B" happens automatically, because the function that predicts the IV data does not contain either ka or F, so when ka and F vary, the residuals on the IV data are constant, thus only the ones on the IV data are affected. However I think "A" is not possible in this case, because as I explained the function that predicts the PO data uses all 4 parameters, so if CL and V vary, all residuals will vary, both the ones on the IV data and the ones on the PO data. So ultimately the PO data would have an impact on the value of CL and V, which is what I must avoid, for reasons that are long to explain but make sense.
Can you please suggest a procedure by which I can achieve what I described? I.e. find the best estimate and variances of parameters CL and V using IV data alone, then of parameters ka and F using PO data alone, and then a covariance matrix for the full set of all 4 parameters.
See below the current method and some sample data in R code format. [You will notice that I used transformations for the 4 parameters, in some cases logarithmic, in some cases by a trigonometric function, in order to limit their ranges to reasonable values. This can be in principle be done by FME using upper and lower bounds, but I found the fitting is more stable if I do it myself].
IV data fitting:
based on function: [itex]
ln ( C_{IV} ) = ln ( dose_{iv} ) - ln ( V) - \frac {CL} {V} \cdot t
[/itex]
PO data fitting:
based on function: [itex]
C_{PO} = F \cdot \frac {dose_{po}} {V} \cdot \frac {ka} {ka - \frac {CL} {V} } \cdot ( e^{- \frac {CL} {V} \cdot t } - e^{-ka \cdot t})
[/itex]
I have some pharmacokinetic data for a molecule that was administered in rat, first IV (intra-venously), then PO (orally). The data are in both cases of the form (time,concentration).
I fit (in R) a first model using the IV data, obtaining estimates for parameters 'CL' and 'V'. Then I fit a second model using the PO data, obtaining estimates for parameters 'ka' and 'F'.
The crucial aspect that is causing all the trouble is that the second model uses the best estimate of CL and V obtained from the first model, but in my implementation the variances of CL and V, calculated when I run the first model, do not enter in any way in the second model, which sounds wrong to me.
Also, the fitting package I am using (FME) calculates the covariance matrix, which I need for other calculations, but of course as this matrix is made only for the modifiable parameters of each model, the one obtained from the second model does not have CL and V in it. But I need to know the covariance between the IV parameters and PO parameters.
I asked a colleague at work, and she suggested to run a single model with all 4 parameters (CL, V, ka, F), where the residuals are calculated using both the IV and PO data.
This is possible in FME, by using two distinct dependent variables, and probably a good idea in general, except that I specifically need: A) CL and V to be regressed only using the IV data, and B) ka and F only using the PO data. "B" happens automatically, because the function that predicts the IV data does not contain either ka or F, so when ka and F vary, the residuals on the IV data are constant, thus only the ones on the IV data are affected. However I think "A" is not possible in this case, because as I explained the function that predicts the PO data uses all 4 parameters, so if CL and V vary, all residuals will vary, both the ones on the IV data and the ones on the PO data. So ultimately the PO data would have an impact on the value of CL and V, which is what I must avoid, for reasons that are long to explain but make sense.
Can you please suggest a procedure by which I can achieve what I described? I.e. find the best estimate and variances of parameters CL and V using IV data alone, then of parameters ka and F using PO data alone, and then a covariance matrix for the full set of all 4 parameters.
See below the current method and some sample data in R code format. [You will notice that I used transformations for the 4 parameters, in some cases logarithmic, in some cases by a trigonometric function, in order to limit their ranges to reasonable values. This can be in principle be done by FME using upper and lower bounds, but I found the fitting is more stable if I do it myself].
IV data fitting:
based on function: [itex]
ln ( C_{IV} ) = ln ( dose_{iv} ) - ln ( V) - \frac {CL} {V} \cdot t
[/itex]
Code:
if (length(find.package(package="FME",quiet=TRUE))==0) install.packages("FME")
require(FME)
dfiv <- data.frame(t1=c(0.05,0.25,0.5,1,3,6),c1=c(250,150,125,77,9.5,0.5))
dfiv_log <- data.frame(t1=dfiv$t1,lc1=log(dfiv$c1))
dose_iv <- 1000
log_C_iv <- function(p,t1) {CL=exp(p[[1]]); V=exp(p[[2]]); log(dose_iv)-log(V)-t1*CL/V}
IV_cost <- function(p) { mo = data.frame(t1=dfiv_log$t1,lc1=log_C_iv(p,dfiv_log$t1)); modCost(model=mo, obs = dfiv_log, x="t1") }
p0iv <- c(pCL=1.57,pV=1.17)
mivlog_FME <- modFit(f=IV_cost,p=p0iv)
mivlog_FME_s <- summary(mivlog_FME)
ps_iv <- mivlog_FME_s$par[,"Estimate"]
mivlog_FME_s
CL <- exp(ps_iv[["pCL"]])
V <- exp(ps_iv[["pV"]])
plot(dfiv_log)
lines(dfiv_log$t1,log_C_iv(ps_iv,dfiv_log$t1))
PO data fitting:
based on function: [itex]
C_{PO} = F \cdot \frac {dose_{po}} {V} \cdot \frac {ka} {ka - \frac {CL} {V} } \cdot ( e^{- \frac {CL} {V} \cdot t } - e^{-ka \cdot t})
[/itex]
Code:
dfpo <- data.frame(t1=c(0,0.25,0.5,1,3,6,24),c1=c(0,130,100,65,30,2,0))
dose_po <- 5000
C_po <- function(p,t1) {ka=exp(p[[1]]); F=0.5+atan(p[[2]])/pi; F*dose_po/V*ka/(ka-CL/V)*(exp(-t1*CL/V)-exp(-t1*ka))}
PO_cost <- function(p) { mo = data.frame(t1=dfpo$t1,c1=C_po(p,dfpo$t1)); modCost(model=mo, obs = dfpo, x="t1") }
p0po <- c(pka=0,aF=0)
mpo_FME <- modFit(f=PO_cost,p=p0po)
mpo_FME_s <- summary(mpo_FME)
ps_po <- mpo_FME_s$par[,"Estimate"]
mpo_FME_s
ka <- exp(ps_po[["pka"]])
F <- 0.5+atan(ps_po[["aF"]])/pi
plot(dfpo)
lines(dfpo$t1,C_po(mpo_FME$par,dfpo$t1))