diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 00000000..6c53d9cc --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.11.0 +Date: 2024-06-19 12:12:13 UTC +SHA: d85d13034a8e067409c1566fe0edd7a84ed1455b diff --git a/DESCRIPTION b/DESCRIPTION index 5440843e..b6a3f6ec 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: PKNCA Type: Package Title: Perform Pharmacokinetic Non-Compartmental Analysis -Version: 0.10.2.9000 +Version: 0.11.0 Authors@R: c( person("Bill", "Denney", email="wdenney@humanpredictions.com", role=c("aut", "cre"), comment=c(ORCID="0000-0002-5759-428X")), person("Clare", "Buckeridge", email="clare.buckeridge@pfizer.com", role="aut"), diff --git a/NEWS.md b/NEWS.md index bfb1ee70..8c4472d2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ will continue until then. These will be especially noticeable around the inclusion of IV NCA parameters and additional specifications of the dosing including dose amount and route. -# PKNCA development version +# PKNCA 0.11.0 * PKNCA will now indicate the number of observations included in a summary ("n") when it is not the same as the number of subjects included in the summary diff --git a/R/intervals.R b/R/intervals.R deleted file mode 100644 index ed4d47e0..00000000 --- a/R/intervals.R +++ /dev/null @@ -1,99 +0,0 @@ -#' Select primary NCA parameters for an interval -#' -#' @inheritParams assert_intervaltime_single -#' @param parameters The NCA parameters to calculate during the interval -#' @param groups The groups to use for parameter calculation -#' @param extrapolation When using an extrapolation method (e.g. for the -#' parameter "aucint"), what extrapolation method should be used? -#' @param clast_extrap When using an extrapolation method, what clast value -#' should be used: "obs" = observed, "pred" = predicted -#' @examples -#' make_intervals(start = 0, end = Inf, parameters = c("cmax", "tmax", "half.life", "aucinf")) -#' -#' @export -make_intervals <- function(start, end, - parameters = NULL, - groups = data.frame(), - route = c("extravascular", "intravascular"), - dose_duration = c("bolus", "infusion"), - dose_type = c("single", "steady-state"), - collection = c("point", "interval"), - extrapolation = c("inf", "last", "all"), - clast_extrap = c("obs", "pred")) { - interval <- assert_intervaltime_single(start, end) - if (!is.data.frame(groups)) { - stop("`groups` must be a data.frame") - } - route <- match.arg(route) - dose_duration <- match.arg(dose_duration) - dose_type <- match.arg(dose_type) - collection <- match.arg(collection) - extrapolation <- match.arg(extrapolation) - clast_extrap <- match.arg(clast_extrap) - if (is.null(parameters)) { - parameters <- - auto_parameters( - start = start, end = end, - route = route, - dose_duration = dose_duration, - dose_type = dose_type, - collection = collection - ) - # auto-select parameters - parameters <- c("cmax", "tmax") - if (end == "inf") { - if (dose_type == "single") { - parameters <- c(parameters, "auclast", "aucinf") - } - parameters <- c(parameters, "half.life") - } else { - # end is not inf - parameters <- c(parameters, "aucint") - } - if (route == "extravascular") { - if (dose_duration == "bolus") { - parameters <- c(parameters, "c0") - } - } - } -} - -#' Auto-select NCA parameters based on dosing type -#' -#' @inheritParams assert_intervaltime_single -#' @param route What is the route of administration? -#' @param dose_duration If `route = "intravascular"` how is the dose -#' administered? Ignored if `route = "extravascular"`. -#' @param dose_type Is the data single-dose or steady-state? -#' @param collection Is the collection at a "point" in time (like plasma, serum, -#' or blood) or an "interval" of time (like urine or feces)? -#' @returns A character vector of parameters to calculate which can be passed to -#' `make_intervals()` -#' @export -auto_parameters <- function(start, end, - route = c("extravascular", "intravascular"), - dose_duration = c("bolus", "infusion"), - dose_type = c("single", "steady-state"), - collection = c("point", "interval")) { - if (collection == "point") { - ret <- c("cmax", "tmax") - if (is.infinite(end)) { - ret <- c(ret, "half.life") - if (dose_type == "single") { - ret <- c(ret, "aucinf.obs", "auclast") - } - } else { - ret <- c(ret, "aucint.inf.obs") - } - if (route == "intravascular") { - if (dose_duration == "bolus") { - ret <- c(ret, "c0") - } else if (dose_duration == "infusion") { - ret <- c(ret, "ceoi") - } - } - } else if (collection == "interval") { - ret <- c("ae", "fe") - } - ret -} diff --git a/R/sparse.R b/R/sparse.R index 6173db18..eaad17e5 100644 --- a/R/sparse.R +++ b/R/sparse.R @@ -65,7 +65,7 @@ sparse_pk_attribute <- function(sparse_pk, ...) { #' #' Where: #' -#' \itemize{ +#' \describe{ #' \item{\eqn{w_i}{w_i}}{is the weight at time i} #' \item{\eqn{\delta_{time,i-1,i}}{d_time[i-1,i]} and \eqn{\delta_{time,i,i+1}}{d_time[i,i+1]}}{are the changes between time i-1 and i or i and i+1 (zero outside of the time range)} #' \item{\eqn{t_i}{t_i}}{is the time at time i} @@ -89,7 +89,7 @@ sparse_auc_weight_linear <- function(sparse_pk) { #' Choices for the method of calculation (the argument `sparse_mean_method`) #' are: #' -#' \itemize{ +#' \describe{ #' \item{"arithmetic mean"}{Arithmetic mean (ignoring number of BLQ samples)} #' \item{"arithmetic mean, <=50% BLQ"}{If >= 50% of the measurements are BLQ, zero. Otherwise, the arithmetic mean of all samples (including the BLQ as zero).} #' } @@ -199,7 +199,7 @@ var_sparse_auc <- function(sparse_pk) { #' defined as zero (rather than dividing by zero). #' #' Where: -#' \itemize{ +#' \describe{ #' \item{\eqn{\hat{\sigma}_{ij}}{sigma_ij}}{The covariance of times i and j} #' \item{\eqn{r_i}{r_i} and \eqn{r_j}{r_j}}{The number of subjects (usually animals) at times i and j, respectively} #' \item{\eqn{r_{ij}{r_ij}}}{The number of subjects (usually animals) at both times i and j} @@ -292,7 +292,7 @@ sparse_to_dense_pk <- function(sparse_pk) { #' #' Where: #' -#' \itemize{ +#' \describe{ #' \item{\eqn{AUC}{AUC}}{is the estimated area under the concentration-time curve} #' \item{\eqn{w_i}{w_i}}{is the weight applied to the concentration at time i (related to the time which it affects, see [sparse_auc_weight_linear()])} #' \item{\eqn{\bar{C}_i}{Cbar_i}}{is the average concentration at time i} diff --git a/R/time_calc.R b/R/time_calc.R index d5f397f0..7f0643d4 100644 --- a/R/time_calc.R +++ b/R/time_calc.R @@ -4,7 +4,7 @@ #' @param time_obs A vector of times for observations #' @param units Passed to `base::as.numeric.difftime()` #' @returns A data.frame with columns for: -#' \itemize{ +#' \describe{ #' \item{event_number_before}{The index of `time_event` that is the last one before `time_obs` or `NA` if none are before.} #' \item{event_number_after}{The index of `time_event` that is the first one after `time_obs` or `NA` if none are after.} #' \item{time_before}{The minimum time that the current `time_obs` is before a `time_event`, 0 if at least one `time_obs == time_event`.} diff --git a/inst/WORDLIST b/inst/WORDLIST index 8752480e..829a9b7b 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -11,6 +11,7 @@ AUMClast Analyte BIP BLQ +Beal's Biometrics Biopharmaceutical CDISC @@ -25,6 +26,7 @@ DL DOI Dixit Durations +Extrap Gabrielsson Hadley Hsuan @@ -96,7 +98,6 @@ conc ctrough customizable dbplyr -difftime doBy doi dosetype diff --git a/man/cov_holder.Rd b/man/cov_holder.Rd index 6c0b8c04..9520ef3e 100644 --- a/man/cov_holder.Rd +++ b/man/cov_holder.Rd @@ -25,7 +25,7 @@ If \eqn{r_{ij} = 0}{r_ij = 0}, then \eqn{\hat{\sigma}_{ij}}{sigma_ij} is defined as zero (rather than dividing by zero). Where: -\itemize{ +\describe{ \item{\eqn{\hat{\sigma}_{ij}}{sigma_ij}}{The covariance of times i and j} \item{\eqn{r_i}{r_i} and \eqn{r_j}{r_j}}{The number of subjects (usually animals) at times i and j, respectively} \item{\eqn{r_{ij}{r_ij}}}{The number of subjects (usually animals) at both times i and j} diff --git a/man/pk.calc.sparse_auc.Rd b/man/pk.calc.sparse_auc.Rd index fe5d9c56..ab8b711a 100644 --- a/man/pk.calc.sparse_auc.Rd +++ b/man/pk.calc.sparse_auc.Rd @@ -44,7 +44,7 @@ The AUC is calculated as: Where: -\itemize{ +\describe{ \item{\eqn{AUC}{AUC}}{is the estimated area under the concentration-time curve} \item{\eqn{w_i}{w_i}}{is the weight applied to the concentration at time i (related to the time which it affects, see \code{\link[=sparse_auc_weight_linear]{sparse_auc_weight_linear()}})} \item{\eqn{\bar{C}_i}{Cbar_i}}{is the average concentration at time i} diff --git a/man/sparse_auc_weight_linear.Rd b/man/sparse_auc_weight_linear.Rd index 331b940a..1373dae9 100644 --- a/man/sparse_auc_weight_linear.Rd +++ b/man/sparse_auc_weight_linear.Rd @@ -23,7 +23,7 @@ The weight is used as the \eqn{w_i}{w_i} parameter in \code{\link[=pk.calc.spars Where: -\itemize{ +\describe{ \item{\eqn{w_i}{w_i}}{is the weight at time i} \item{\eqn{\delta_{time,i-1,i}}{d_time[i-1,i]} and \eqn{\delta_{time,i,i+1}}{d_time[i,i+1]}}{are the changes between time i-1 and i or i and i+1 (zero outside of the time range)} \item{\eqn{t_i}{t_i}}{is the time at time i} diff --git a/man/sparse_mean.Rd b/man/sparse_mean.Rd index 25cefd38..f59377f4 100644 --- a/man/sparse_mean.Rd +++ b/man/sparse_mean.Rd @@ -25,7 +25,7 @@ Choices for the method of calculation (the argument \code{sparse_mean_method}) are: } \details{ -\itemize{ +\describe{ \item{"arithmetic mean"}{Arithmetic mean (ignoring number of BLQ samples)} \item{"arithmetic mean, <=50\% BLQ"}{If >= 50\% of the measurements are BLQ, zero. Otherwise, the arithmetic mean of all samples (including the BLQ as zero).} } diff --git a/man/time_calc.Rd b/man/time_calc.Rd index 27637ff7..7b432916 100644 --- a/man/time_calc.Rd +++ b/man/time_calc.Rd @@ -15,7 +15,7 @@ time_calc(time_event, time_obs, units = NULL) } \value{ A data.frame with columns for: -\itemize{ +\describe{ \item{event_number_before}{The index of \code{time_event} that is the last one before \code{time_obs} or \code{NA} if none are before.} \item{event_number_after}{The index of \code{time_event} that is the first one after \code{time_obs} or \code{NA} if none are after.} \item{time_before}{The minimum time that the current \code{time_obs} is before a \code{time_event}, 0 if at least one \code{time_obs == time_event}.} diff --git a/vignettes/v06-half-life-calculation-tobit.Rmd b/vignettes/v06-half-life-calculation-tobit.Rmd index 51207a38..4f3ec8c4 100644 --- a/vignettes/v06-half-life-calculation-tobit.Rmd +++ b/vignettes/v06-half-life-calculation-tobit.Rmd @@ -88,7 +88,7 @@ The steps for Tobit regression are: 2. The $\lambda_z$ value (slope for the half-life line) must be positive; in other words, the half-life slope must be decreasing. -# Comparision of Tobit and semi-log regression +# Comparison of Tobit and semi-log regression In almost all scenarios, Tobit regression using the algorithm above improves the half-life estimate compared to semi-log regression. In the figure below,