Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ 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.aumciv)
export(pk.calc.auxc)
export(pk.calc.auxcint)
export(pk.calc.auxciv)
export(pk.calc.c0)
export(pk.calc.cav)
export(pk.calc.ceoi)
Expand All @@ -204,6 +212,9 @@ export(pk.calc.cstart)
export(pk.calc.ctrough)
export(pk.calc.deg.fluc)
export(pk.calc.dn)
export(pk.calc.ermax)
export(pk.calc.ertlst)
export(pk.calc.ertmax)
export(pk.calc.f)
export(pk.calc.fe)
export(pk.calc.half.life)
Expand All @@ -214,6 +225,8 @@ export(pk.calc.mrt.md)
export(pk.calc.ptr)
export(pk.calc.sparse_auc)
export(pk.calc.sparse_auclast)
export(pk.calc.sparse_aumc)
export(pk.calc.sparse_aumclast)
export(pk.calc.swing)
export(pk.calc.tfirst)
export(pk.calc.thalf.eff)
Expand Down Expand Up @@ -244,6 +257,7 @@ export(superposition)
export(time_calc)
export(ungroup)
export(var_sparse_auc)
export(var_sparse_aumc)
importFrom(dplyr,"%>%")
importFrom(dplyr,filter)
importFrom(dplyr,full_join)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ the dosing including dose amount and route.

# Development version

## 2025-12-04 Changes in this version

* Added new AUC Parameters related to CL, Kel, MRT, Vss and Vz
* Removed `aumc_integrate()` function; simplified usage by using `auc_integrate()` with arguments `fun_linear`, `fun_log`, and `fun_inf`. (#493)
* Refactored `pk.calc.aucint()` and `pk.calc.aumcint()`:
- Renamed original `pk.calc.aucint()` to `pk.calc.auxcint()` and added integration functions as arguments.
- Created new `pk.calc.aucint()` and `pk.calc.aumcint()` calling `pk.calc.auxcint()` with proper integration functions. (#494)
* Refactored `pk.calc.auciv()` and `pk.calc.aumciv()` similarly to #494. (#495)
* Saprse AUMC functions added

## Breaking changes

* Both include and excluding half-life points may not be done for the same interval (#406)
Expand Down
2 changes: 1 addition & 1 deletion R/auc.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pk.calc.auxc <- function(conc, time, interval=c(0, Inf),
conc.blq=NULL,
conc.na=NULL,
check=TRUE,
fun_linear, fun_log, fun_inf) {
fun_linear, fun_log, fun_inf, ...) {
# Check the inputs
method <- PKNCA.choose.option(name="auc.method", value=method, options=options)
if (check) {
Expand Down
44 changes: 0 additions & 44 deletions R/auc_integrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,47 +184,3 @@ auc_integrate <- function(conc, time, clast, tlast, lambda.z, interval_method, f
ret
}

#' Support function for AUMC integration (reuses the same interval_method logic as AUC)
#'
#' @inheritParams auc_integrate
#' @param fun_linear Linear trapezoidal rule for t×conc (AUMC)
#' @param fun_log Log trapezoidal rule for t×conc (AUMC)
#' @param fun_inf Analytical extrapolation to infinity for AUMC
#'
#' @details
#' This function works identically to `auc_integrate()`, but integrates
#' the first moment curve (t × conc) instead of conc.
#' The `interval_method` vector from `choose_interval_method()` is reused directly.
#'
#' @returns The numeric value of the AUMC
#' @keywords internal
aumc_integrate <- function(conc, time, clast, tlast, lambda.z, interval_method,
fun_linear, fun_log, fun_inf) {
assert_lambdaz(lambda.z = lambda.z)

interval_method_within <- interval_method[-length(interval_method)]
interval_method_extrap <- interval_method[length(interval_method)]

idx_1 <- seq_len(length(conc) - 1)
idx_1_linear <- idx_1[interval_method_within == "linear"]
idx_1_log <- idx_1[interval_method_within == "log"]

ret <-
c(
fun_linear(conc[idx_1_linear], conc[idx_1_linear + 1],
time[idx_1_linear], time[idx_1_linear + 1]),
fun_log(conc[idx_1_log], conc[idx_1_log + 1],
time[idx_1_log], time[idx_1_log + 1])
)

if (interval_method_extrap %in% "extrap_log") {
# Whether AUMCinf,obs or AUMCinf,pred is calculated depends on if clast,obs
# or clast,pred is passed in.
ret[length(ret)+1] <- fun_inf(clast, tlast, lambda.z)
} else if (interval_method_extrap != "zero") {
stop("Invalid interval_method_extrap in aumc_integrate, please report a bug: ", interval_method_extrap) # nocov
}

ret <- sum(ret)
ret
}
Loading
Loading