noncompAUC | R Documentation |
Given a data.frame of concentration-time data, noncompAUC
calculates
the area under the concentration-time curve for the times included in the
input data.frame using either the linear or the linear up/log down
trapezoidal rule. Optionally extrapolate to infinity or back extrapolate to
t0.
noncompAUC(
DF,
concentration = Concentration,
time = Time,
type = "LULD",
extrap_inf = FALSE,
extrap_inf_coefs = NULL,
extrap_inf_times = c(NA, NA),
reportTermFit = FALSE,
reportFractExtrap = FALSE,
extrap_t0 = FALSE,
extrap_t0_coefs = NULL,
extrap_t0_model = "monoexponential",
extrap_t0_times = c(NA, NA),
reportBackExtrapFit = FALSE,
reportC0 = FALSE
)
DF |
Input data.frame with concentration-time data. |
concentration |
The name of the column containing drug concentrations |
time |
The name of the column containing time data |
type |
The type of trapezoidal rule to use. Options are "LULD" (default) for "linear up, log down" or "linear". |
extrap_inf |
Extrapolate the curve to infinity? TRUE or FALSE. |
extrap_inf_coefs |
If you've already performed a nonlinear regression to
a monoexponential decay equation, |
extrap_inf_times |
If |
reportTermFit |
TRUE or FALSE for whether to report the fit for the
terminal elimination calculation. If TRUE, this changes the output from a
single number to a named list that includes the AUC and the terminal
elimination fit (will be named "Terminal elimination fit") from
|
reportFractExtrap |
TRUE or FALSE for whether to report the fraction of the AUC extrapolated to infinity. If TRUE, this changes the output from a single number to a named list that includes the AUC and the fraction extrapolated to infinity (will be named "Fraction extrapolated to infinity"). |
extrap_t0 |
TRUE or FALSE for whether to back extrapolate the curve to 0. This is useful when the dose was administered IV and you know you're missing a significant portion of the curve from t0 to the first sampling time. |
extrap_t0_coefs |
If you've already performed a nonlinear regression to
a monoexponential, biexponential, or triexponential decay equation,
|
extrap_t0_model |
"monoexponential" or "biexponential". Only used when
|
extrap_t0_times |
If |
reportBackExtrapFit |
TRUE or FALSE for whether to report the fit for
the back-extrapolation to t0 calculation. If TRUE, this changes the output
from a single number to a named list that includes the AUC and the back
extrapolated fit (will be named "Back-extrapolation to t0 fit") from
|
reportC0 |
TRUE or FALSE for whether to report the back-extrapolated concentration at t0. If TRUE, the output becomes a named list that includes the AUC and the extrapolated C0 value (will be named "C0"). This is useful as a sanity check because the maximum concentration at t0 in, e.g., plasma should be no larger than approximately the dose / total plasma volume, which is ~3 L in a healthy, 70-kg adult. |
A few notes:
If there are two consecutive time points with the same measured concentration, that results in an undefined value for the log trapezoidal rule. To deal with this, anytime the user has opted for the linear up/log down trapezoidal rule but there are also consecutive time points with the same concentration, those individual trapezoids will be calculated linearly rather than using a log function and all AUCs will be added together at the end.
I intentionally omitted the option of using cubic splines for calculating the AUC because they can become unstable with noisy concentration-time data and are thus less desireable than the trapezoidal rule. For more details, please see https://www.certara.com/2011/04/02/calculating-auc-linear-and-log-linear/.
Returns the calculated AUC as a number or, depending on the options
selected, a named list of the AUC (AUC[["AUC"]]
), the fraction of
the curve extrapolated to infinity (AUC[["Fraction extrapolated to
infinity"]]
), and the back extrapolated C0 (AUC[["C0"]]
).
data(ConcTime)
IV1 <- ConcTime %>% dplyr::filter(SubjectID == 101 & Drug == "A" &
DoseRoute == "IV")
noncompAUC(IV1, time = TimeHr)
noncompAUC(IV1, time = TimeHr, type = "LULD")
noncompAUC(IV1, time = TimeHr, type = "linear")
# Extrapolating to infinity
noncompAUC(IV1, time = TimeHr, extrap_inf = TRUE,
extrap_inf_times = c(0.5, NA))
# Extrapolating to infinity and reporting the fraction extrapolated
noncompAUC(IV1, time = TimeHr, extrap_inf = TRUE,
extrap_inf_times = c(0.5, NA),
reportFractExtrap = TRUE)
# Back extrapolating to t0
noncompAUC(IV1, time = TimeHr, extrap_t0 = TRUE,
extrap_t0_model = "monoexponential",
extrap_t0_times = c(0.5, NA))
# Back extrapolating to t0 and reporting extrapolated C0
noncompAUC(IV1, time = TimeHr, extrap_t0 = TRUE,
extrap_t0_model = "monoexponential",
extrap_t0_times = c(0.5, NA),
reportC0 = TRUE)
# Extrapolating to infinity, reporting the fraction extrapolated to infinity,
# back extrapolating to t0, and reporting extrapolated C0
noncompAUC(IV1, time = TimeHr,
extrap_inf = TRUE,
extrap_inf_times = c(0.5, NA),
reportFractExtrap = TRUE,
extrap_t0 = TRUE,
extrap_t0_model = "monoexponential",
extrap_t0_times = c(0.5, NA),
reportC0 = TRUE)
# For supplying your own coefficients to back extrapolate with:
tmax <- 0.5
# The elimination phase begins at t = 0.5 hrs here, so don't start fitting at
# t0; you'll get bad estimates.
Fit <- nls(Concentration ~ A * exp(-k * (TimeHr - tmax)),
data = IV1 %>% dplyr::filter(TimeHr >= tmax),
start = list(A = max(IV1$Concentration), k = 0.01))
MyCoefs <- summary(Fit)[["coefficients"]]
# Extrapolating to infinity with supplied coefficients
noncompAUC(IV1, time = TimeHr, extrap_inf = TRUE,
extrap_inf_times = c(0.5, NA),
extrap_inf_coefs = MyCoefs)
# Back extapolating to t0 with supplied coefficients
noncompAUC(IV1, time = TimeHr, extrap_t0 = TRUE,
extrap_t0_coefs = list(coefs = MyCoefs,
tmax = tmax))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.