knitr::opts_chunk$set(echo = TRUE)
library(PKNCA)
library(dplyr)

Introduction

Interpolation and extrapolation with awareness of doses occurring before, at the same time of, or after the requested interpolation time point must account for many interactions. To ensure clarity in the interpolation/extrapolation methods and the decisions made by the algorithm, each potential choice is listed below with its accompanying calculation method. The code used to generate the table is the same as the code within the function.

method.choices <- names(PKNCA:::interp.extrap.conc.dose.select)
method.choices <-
  factor(method.choices, levels=method.choices, ordered=TRUE)

all_combs <-
  expand.grid(event_before=setdiff(unlist(PKNCA:::event_choices_interp.extrap.conc.dose), "output_only"),
              event=setdiff(unlist(PKNCA:::event_choices_interp.extrap.conc.dose), "none"),
              event_after=setdiff(unlist(PKNCA:::event_choices_interp.extrap.conc.dose), "output_only"),
              Method="",
              stringsAsFactors=FALSE)

for (n in method.choices) {
  mask <-
    do.call(PKNCA:::interp.extrap.conc.dose.select[[n]]$select,
            list(x=all_combs),
            envir=environment(pk.nca))
  all_combs$Method[mask] <- n
}

all_combs <-
  all_combs[do.call(order,
                    args=append(as.list(all_combs), list(na.last=FALSE))),]

Methods

The method list below is described and sorted in order of how many scenarios the method is applied to in the list.

For each of the summary tables below, the column headers are as follows:

methodorder <- names(sort(summary(factor(all_combs$Method)), decreasing=TRUE))

for (n in methodorder) {
  cat("## ", n, "\n\n", sep="")
  cat(PKNCA:::interp.extrap.conc.dose.select[[n]]$description, "\n\n", sep="")
  print(knitr::kable(
    all_combs[all_combs$Method %in% n,
              c("event_before","event", "event_after")],
    row.names=FALSE,
    col.names=c("Event Before", "Event At", "Event After")))
  cat("\n")
}

Appendix: Complete Methods Table

knitr::kable(
  all_combs[,c("event_before", "event", "event_after", "Method")],
    row.names=FALSE,
    col.names=c("Event Before", "Event At", "Event After", "Method Used"))


billdenney/pknca documentation built on June 11, 2025, 1:49 a.m.