| biexp {PK} | R Documentation |
Estimation of initial and terminal half-life by fitting a biexponential model.
biexp(conc, time, log.scale=FALSE, baseline=0, tol=1E-9, maxit=500)
conc |
Levels of concentrations. |
time |
Time points of concentration assessment. |
log.scale |
Logical value indicating whether fitting is performed on the observed or log-scale (default=FALSE). |
baseline |
Pre-dosing value (default=0). |
tol |
Relative error tolerance (default=1E-9). |
maxit |
Maximum number of iterations (default=500). |
Estimation of initial and terminal half-life using the biexponential y=a1*exp(-b1*x)+a2*exp(-b2*x) model with a parameterization to ensure b1 > b2 > 0 fitted by the least squares criteria with function optim of package base with method "Nelder-Mead". Curve peeling (Foss, 1969) is used get start values for nonlinear model fitting. When no adequate starting values are determined by curve peeling, a single exponential model is fitted with starting values obtained from an OLS regression on log transformed values with a parameterization to ensure a slope > 0.
If the baseline value indicating that the intrinsic level is greater than zero, the pre-dosing value is subtracted from all concentration levels before calculation. Resulting values of zero or below zero are omitted.
A list of S3 class "halflife" containing the following components:
parms |
half-life and model estimates. |
time |
time points of concentration assessments. |
conc |
levels of concentrations. |
method |
"biexp". |
Records including missing values and values below or equal to zero are omitted.
Martin J. Wolfsegger and Thomas Jaki
Foss S. D. (1969). A Method for Obtaining Initial Estimates of the Parameters in Exponential Curve Fitting. Biometrics, 25:580-584.
Pinheiro J. C. and Bates D. M. (2000). Mixed-Effects Models in S and S-PLUS. Springer, New York.
## example from Pinheiro J.C. and Bates D.M. (2000, page 279)
## dataset Indometh of package datasets
require(datasets)
time <- Indometh$time
conc <- Indometh$conc
# fitting on observed and log-scale
res1 <- biexp(conc=conc, time=time, log.scale=FALSE)
res2 <- biexp(conc=conc, time=time, log.scale=TRUE)
print(res1$parms)
print(res2$parms)
plot(res1, xlim=c(0, max(time)))
plot(res2, xlim=c(0, max(time)), add=TRUE, lty=2)
legend(x=5, y=2.5, lty=c(1,2), legend=c("fitted on observed scale", "fitted on log-scale"))
# get residuals using function nls with maxiter=1 and tol=Inf
parms.obs <- list(a1=res1$parms[3,1], b1=res1$parms[2,1], a2=res1$parms[3,2], b2=res1$parms[2,2])
parms.log <- list(a1=res2$parms[3,1], b1=res2$parms[2,1], a2=res2$parms[3,2], b2=res2$parms[2,2])
resid.obs <- nls(conc ~ a1*exp(-b1*time) + a2*exp(-b2*time), start=parms.obs,
control=nls.control(maxiter=1, tol=Inf))
resid.log <- nls(log(conc) ~ log(a1*exp(-b1*time) + a2*exp(-b2*time)), start=parms.log,
control=nls.control(maxiter=1, tol=Inf))
plot.new()
plot(x=c(0, max(time)), y=c(-1,1), type="n", xlab="Time", ylab="Residuals")
abline(h=0)
points(y=summary(resid.obs)$res, x=time, col="red")
points(y=summary(resid.log)$res, x=time, col="blue")
legend(x=0, y=1, pch=c(21,21), col=c("red","blue"), legend=c("fitted on observed scale",
"fitted on log-scale"))
# see also function SSbiexp of package stats
parms.ssbiexp <- as.list(coef(nls(conc ~ SSbiexp(time, a1, b1, a2, b2))))
parms.ssbiexp <- list(a1=parms.ssbiexp$a1, b1=exp(parms.ssbiexp$b1), a2=parms.ssbiexp$a2,
b2=exp(parms.ssbiexp$b2))
print(unlist(parms.ssbiexp))
print(unlist(parms.obs))
print(unlist(parms.log))