Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cd66967
add.interval.col: add formula arg (default NULL)
Gero1999 Jan 15, 2026
60086df
add formula to PK parameters (LaTeX; double slash for R compatibility)
Gero1999 Jan 15, 2026
a6ce5e4
v03: add Formula column in vignette table
Gero1999 Jan 15, 2026
04493d5
try: render latex in kable
Gero1999 Jan 15, 2026
797c1e1
make a file that creates the table in markdown format
Gero1999 Mar 18, 2026
47e0ec7
final vignette to use for parameters table
Gero1999 Mar 18, 2026
0abc4f1
add missing formulas to the other add.interval.col calls
Gero1999 Mar 18, 2026
96d9806
generate new vignette with all formulas
Gero1999 Mar 18, 2026
b5dad7c
include more formulas
Gero1999 Mar 19, 2026
d0c1789
rename vignette name to differentiate it
Gero1999 Mar 19, 2026
851d128
try to relocate in navbar of the webpage
Gero1999 Mar 19, 2026
3babc5b
simplify nav structure
Gero1999 Mar 19, 2026
e3a20e4
merge main, 5 conflictive files solved
Gero1999 Mar 20, 2026
6f1d8c2
update parameters table
Gero1999 Mar 20, 2026
d8501e6
use regex to customize formulas in a loop for dn parameters
Gero1999 Mar 20, 2026
846ac3a
fix undetected issues from merge
Gero1999 Mar 20, 2026
1e26e61
fix tests failing
Gero1999 Mar 20, 2026
288f1af
add docs for formula param in add.interval.cols
Gero1999 Mar 20, 2026
84b713b
rm paramters that were already removed from main
Gero1999 Mar 20, 2026
7f3df24
fix: rm more sparse parameters
Gero1999 Mar 20, 2026
8734aff
rm change in test-pk.calc.all done
Gero1999 Mar 20, 2026
487c549
make changes suggested for formulas, add also formula_note column for…
Gero1999 Mar 24, 2026
da30dde
replace old parameters-available table
Gero1999 Mar 24, 2026
7b5c833
small refactoring
Gero1999 Mar 24, 2026
446a486
adapt test to new formula_note arg in add.interval.col()
Gero1999 Mar 25, 2026
0df82db
add missing man
Gero1999 Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ export(pk.calc.aumc.inf)
export(pk.calc.aumc.inf.obs)
export(pk.calc.aumc.inf.pred)
export(pk.calc.aumc.last)
export(pk.calc.aumcint)
export(pk.calc.aumcint.all)
export(pk.calc.aumcint.inf.obs)
export(pk.calc.aumcint.inf.pred)
export(pk.calc.aumcint.last)
export(pk.calc.auxc)
export(pk.calc.c0)
export(pk.calc.cav)
Expand Down
16 changes: 13 additions & 3 deletions R/001-add.interval.col.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ assign("interval.cols", list(), envir=.PKNCAEnv)
#' to NCA parameter names. See the details for information on use of
#' `formalsmap`.
#' @param datatype The type of data used for the calculation
#' @param formula Character value providing a LaTeX expression to identify how the
#' calculation of the parameter is performed. It is an optional argument merely
#' used for documentation.
#' @param formula_note Character value providing additional context about the
#' formula (e.g. assumptions, method details). Displayed alongside the formula
#' in documentation tables.
#' @returns NULL (Calling this function has a side effect of changing the
#' available intervals for calculations)
#'
Expand Down Expand Up @@ -89,8 +95,10 @@ add.interval.col <- function(name,
sparse=FALSE,
formalsmap=list(),
datatype=c("interval",
"individual",
"population")) {
"individual",
"population"),
formula=NULL,
formula_note=NULL) {
# Check inputs
if (!is.character(name)) {
stop("name must be a character string")
Expand Down Expand Up @@ -170,7 +178,9 @@ add.interval.col <- function(name,
sparse=sparse,
formalsmap=formalsmap,
depends=depends,
datatype=datatype
datatype=datatype,
formula=formula,
formula_note=formula_note
)
assign("interval.cols", current, envir=.PKNCAEnv)
}
Expand Down
41 changes: 26 additions & 15 deletions R/auc.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ pk.calc.auxc <- function(conc, time, interval=c(0, Inf),
}
auc.type <- match.arg(auc.type)
interval <- assert_intervaltime_single(interval = interval)
if (auc.type %in% "AUCinf" & is.finite(interval[2])) {
if (auc.type %in% "AUCinf" && is.finite(interval[2])) {
warning("Requesting AUCinf when the end of the interval is not Inf")
}

# Subset the data to the range of interest ####
interval_start <- interval[1]
interval_end <- interval[2]
Expand Down Expand Up @@ -257,9 +257,9 @@ pk.calc.auc.all <- function(conc, time, ..., options=list()) {
#' @export
pk.calc.aumc <- function(conc, time, ..., options=list()) {
pk.calc.auxc(conc=conc, time=time, ..., options=options,
fun_linear = aumcintegrate_linear,
fun_log = aumcintegrate_log,
fun_inf = aumcintegrate_inf
fun_linear = aumcintegrate_linear,
fun_log = aumcintegrate_log,
fun_inf = aumcintegrate_inf
)
}

Expand Down Expand Up @@ -296,7 +296,7 @@ pk.calc.aumc.inf.obs <- function(conc, time, clast.obs, ..., options=list(),
#' @describeIn pk.calc.auxc Compute the AUMCinf with the predicted Clast.
#' @export
pk.calc.aumc.inf.pred <- function(conc, time, clast.pred, ..., options=list(),
lambda.z) {
lambda.z) {
pk.calc.aumc.inf(conc=conc, time=time, clast=clast.pred, ..., options=options,
lambda.z=lambda.z)
}
Expand All @@ -318,60 +318,71 @@ add.interval.col("aucinf.obs",
unit_type="auc",
pretty_name="AUCinf,obs",
desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast",
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
formula="$AUC_{\\infty,\\text{obs}} = AUC_{0-\\text{last}} + \\frac{C_{\\text{last,obs}}}{\\lambda_z}$")

add.interval.col("aucinf.pred",
FUN="pk.calc.auc.inf.pred",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUCinf,pred",
desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast",
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
formula="$AUC_{\\infty,\\text{pred}} = AUC_{0-\\text{last}} + \\frac{C_{\\text{last,pred}}}{\\lambda_z}$")

add.interval.col("auclast",
FUN="pk.calc.auc.last",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUClast",
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification")
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification",
formula="$AUC_{\\text{last}} = \\sum_{k} AUC_k(C_k, C_{k+1}, t_k, t_{k+1})$",
formula_note="Trapezoidal rule (linear-up/log-down by default)")

add.interval.col("aucall",
FUN="pk.calc.auc.all",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUCall",
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification"
)
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification",
formula="$AUC_{\\text{all}} = \\sum_{k} AUC_k(C_k, C_{k+1}, t_k, t_{k+1})$",
formula_note="Trapezoidal rule (linear-up/log-down by default)")

add.interval.col("aumcinf.obs",
FUN="pk.calc.aumc.inf.obs",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,inf,obs",
desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast",
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
formula="$AUMC_{\\infty,\\text{obs}} = AUMC_{0-\\text{last}} + \\frac{C_{\\text{last,obs}} T_{\\text{last}}}{\\lambda_z} + \\frac{C_{\\text{last,obs}}}{\\lambda_z^2}$")

add.interval.col("aumcinf.pred",
FUN="pk.calc.aumc.inf.pred",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,inf,pred",
desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast",
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
formula="$AUMC_{\\infty,\\text{pred}} = AUMC_{0-\\text{last}} + \\frac{C_{\\text{last,pred}} T_{\\text{last}}}{\\lambda_z} + \\frac{C_{\\text{last,pred}}}{\\lambda_z^2}$")

add.interval.col("aumclast",
FUN="pk.calc.aumc.last",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,last",
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification")
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification",
formula="$AUMC_{\\text{last}} = \\sum_{k} AUMC_k(C_k, C_{k+1}, t_k, t_{k+1})$",
formula_note="Trapezoidal rule (linear-up/log-down by default)")

add.interval.col("aumcall",
FUN="pk.calc.aumc.all",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,all",
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification plus the moment of the triangle from that last concentration to 0 at the first concentration below the limit of quantification")
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification plus the moment of the triangle from that last concentration to 0 at the first concentration below the limit of quantification",
formula="$AUMC_{\\text{all}} = \\sum_{k} AUMC_k(C_k, C_{k+1}, t_k, t_{k+1})$",
formula_note="Trapezoidal rule (linear-up/log-down by default)")

PKNCA.set.summary(
name=
Expand Down
Loading
Loading