Skip to content

Rename pk.calc.auciv() to pk.calc.auxciv() and generalize its use #495

@billdenney

Description

@billdenney

Please do the same operations as suggested in #494, but for the pk.calc.auciv() and pk.calc.aumciv() functions.

pknca/R/auciv.R

Lines 203 to 245 in aac6a30

#' Calculate AUMC for intravenous dosing with C0 back-extrapolation
#'
#' @details Analogous to pk.calc.auciv but for AUMC.
#' Replaces the first AUMC interval (from measured C0) with one using extrapolated c0.
#'
#' @inheritParams pk.calc.auxc
#' @param c0 The concentration at time 0 (extrapolated)
#' @param aumc The AUMC calculated without c0 adjustment (e.g., aumcall, aumclast)
#' @return The AUMC with IV back-extrapolation applied
#' @export
pk.calc.aumciv <- function(conc, time, c0, aumc, ..., options = list(), check = TRUE) {
if (check) {
assert_conc_time(conc = conc, time = time)
data <- clean.conc.blq(conc, time, options = options, check = FALSE)
} else {
data <- data.frame(conc = conc, time = time)
}
if (!(0 %in% time)) {
return(structure(NA_real_, exclude = "No time 0 in data"))
} else if (is.na(c0)) {
return(structure(NA_real_, exclude = "c0 is not calculated"))
}
# AUMC for first interval using measured concentrations
aumc_first <- pk.calc.aumc.last(
conc = data$conc[1:2],
time = data$time[1:2],
...,
check = FALSE
)
# AUMC for first interval using extrapolated c0
aumc_second <- pk.calc.aumc.last(
conc = c(c0, data$conc[2]),
time = data$time[1:2],
...,
check = FALSE
)
aumc_final <- aumc + aumc_second - aumc_first
aumc_final
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions