From d5eabf494b6173112fa0b1a59bd3411d90fd7003 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Fri, 29 Oct 2021 14:38:58 -0400 Subject: [PATCH] preparation for version 0.9.5 cran submission --- .gitignore | 2 + DESCRIPTION | 7 +- NAMESPACE | 2 - NEWS.md | 2 +- README.md | 2 +- doc/AUC-Calculation-with-PKNCA.html | 577 ++++----- doc/Example-theophylline.html | 1089 +++++++++-------- doc/Half-Life-Calculation.html | 332 +++++ doc/Introduction-and-Usage.html | 679 +++++----- ...Aware-Interpolation-and-Extrapolation.html | 207 +--- doc/Options-for-Controlling-PKNCA.html | 316 ++--- doc/PKNCA-validation.html | 523 ++++---- doc/Post-Processing.html | 456 +++++++ doc/Selection-of-Calculation-Intervals.html | 437 +++---- doc/Superposition.html | 323 ++--- doc/Writing-Parameter-Functions.html | 205 +--- man/group_vars.PKNCAconc.Rd | 4 +- vignettes/Post-Processing.Rmd | 2 +- 18 files changed, 2536 insertions(+), 2629 deletions(-) create mode 100644 doc/Half-Life-Calculation.html create mode 100644 doc/Post-Processing.html diff --git a/.gitignore b/.gitignore index 1ee29bdb..f7bfe2b5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ doc Meta docs +/doc/ +/Meta/ diff --git a/DESCRIPTION b/DESCRIPTION index 3f8ddbb6..ccb88906 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: PKNCA Type: Package Title: Perform Pharmacokinetic Non-Compartmental Analysis -Version: 0.9.4.9001 +Version: 0.9.5 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"), @@ -27,9 +27,10 @@ Suggests: Description: Compute standard Non-Compartmental Analysis (NCA) parameters for typical pharmacokinetic analyses and summarize them. License: AGPL-3 -URL: http://billdenney.github.io/pknca, https://github.com/billdenney/pknca +URL: https://billdenney.github.io/pknca/, https://github.com/billdenney/pknca BugReports: https://github.com/billdenney/pknca/issues NeedsCompilation: no VignetteBuilder: knitr -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 Encoding: UTF-8 +Language: en-US diff --git a/NAMESPACE b/NAMESPACE index a901de19..42287470 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,8 +11,6 @@ S3method(PKNCAdose,data.frame) S3method(PKNCAdose,default) S3method(PKNCAdose,tbl_df) S3method(as.data.frame,PKNCAresults) -S3method(dplyr::group_vars,PKNCAconc) -S3method(dplyr::group_vars,PKNCAdose) S3method(exclude,default) S3method(formula,PKNCAconc) S3method(formula,PKNCAdose) diff --git a/NEWS.md b/NEWS.md index 8c5f6d3d..a7666332 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,7 +14,7 @@ the dosing including dose amount and route. and PKNCAdose objects were removed along with the merge.splitList function. * Single-subject (ungrouped) analysis works without creating a dummy group (#74) * PKNCAconc objects are checked earlier for valid data (#154) -* Add time_above parameter to calcualte time above a given concentration. +* Add time_above parameter to calculate time above a given concentration. * Fix numeric BLQ replacement when the value is a number and different values are given for first, middle, and last (related to #145). This only affects datasets where BLQ is being replaced with a nonzero value (not a common diff --git a/README.md b/README.md index 1e5a4cd5..84cc61ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/PKNCA)](https://cran.r-project.org/package=PKNCA) [![R build status](https://github.com/billdenney/pknca/workflows/R-CMD-check/badge.svg)](https://github.com/billdenney/pknca/actions) -[![Code_Coverage_Badge](http://codecov.io/github/billdenney/pknca/coverage.svg?branch=master)](http://codecov.io/github/billdenney/pknca?branch=master) +[![Code_Coverage_Badge](https://codecov.io/github/billdenney/pknca/coverage.svg?branch=master)](https://codecov.io/github/billdenney/pknca?branch=master) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2054/badge)](https://bestpractices.coreinfrastructure.org/projects/2054) diff --git a/doc/AUC-Calculation-with-PKNCA.html b/doc/AUC-Calculation-with-PKNCA.html index 77dd4742..470f127f 100644 --- a/doc/AUC-Calculation-with-PKNCA.html +++ b/doc/AUC-Calculation-with-PKNCA.html @@ -1,38 +1,54 @@ - + - - + AUC Calculation with PKNCA + + - + + + + @@ -321,49 +156,50 @@

Bill Denney

Preparation

For the below examples, the following data will be used.

-
suppressPackageStartupMessages({
-  library(PKNCA)
-  library(dplyr)
-  library(cowplot)
-  library(knitr)
-  library(ggplot2)
-})
-scale_colour_discrete <- scale_colour_hue
-scale_fill_discrete <- scale_fill_hue
-
-my_conc <- data.frame(conc=c(0, 2.5, 3, 2, 1.5, 1.2, 1.1, 0, 0),
-                      time=c(0:5, 8, 12, 24),
-                      subject=1)
-my_conc$BLOQ <- my_conc$conc == 0
-my_conc$measured <- TRUE
-
ggplot(my_conc,
-       aes(x=time,
-           y=conc,
-           shape=BLOQ,
-           group=subject)) +
-  geom_line() +
-  geom_point(size=4) +
-  scale_x_continuous(breaks=my_conc$time) +
-  theme(legend.position=c(0.8, 0.8))
-

+
suppressPackageStartupMessages({
+  library(PKNCA)
+  library(dplyr)
+  library(cowplot)
+  library(knitr)
+  library(ggplot2)
+})
+
## Warning: package 'knitr' was built under R version 4.1.1
+
scale_colour_discrete <- scale_colour_hue
+scale_fill_discrete <- scale_fill_hue
+
+my_conc <- data.frame(conc=c(0, 2.5, 3, 2, 1.5, 1.2, 1.1, 0, 0),
+                      time=c(0:5, 8, 12, 24),
+                      subject=1)
+my_conc$BLQ <- my_conc$conc == 0
+my_conc$measured <- TRUE
+
ggplot(my_conc,
+       aes(x=time,
+           y=conc,
+           shape=BLQ,
+           group=subject)) +
+  geom_line() +
+  geom_point(size=4) +
+  scale_x_continuous(breaks=my_conc$time) +
+  theme(legend.position=c(0.8, 0.8))
+

For the purpose of illustration, NCA parameters will also be calculated for each of the AUC types below. Note that in the results, more parameters are returned than were requested. The additional parameters are the set of parameters required to calculate the requested parameters.

-
conc_obj <- PKNCAconc(my_conc, conc~time|subject)
-data_obj <- PKNCAdata(data.conc=conc_obj,
-                      intervals=data.frame(start=0,
-                                           end=24,
-                                           aucall=TRUE,
-                                           auclast=TRUE,
-                                           aucinf.pred=TRUE,
-                                           aucinf.obs=TRUE))
-results_obj <- pk.nca(data_obj)
+
conc_obj <- PKNCAconc(my_conc, conc~time|subject)
+data_obj <- PKNCAdata(data.conc=conc_obj,
+                      intervals=data.frame(start=0,
+                                           end=24,
+                                           aucall=TRUE,
+                                           auclast=TRUE,
+                                           aucinf.pred=TRUE,
+                                           aucinf.obs=TRUE))
+results_obj <- pk.nca(data_obj)
## No dose information provided, calculations requiring dose will return NA.
-
kable(as.data.frame(results_obj))
+
kable(as.data.frame(results_obj))
+ - @@ -371,121 +207,121 @@

Preparation

+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - @@ -496,130 +332,130 @@

Preparation

AUC to the Last Value Above the Limit of Quantification (AUClast)

AUC0-last calculates the AUC from time 0 to the last value above the limit of quantification, tlast (within PKNCA, this is the last value above 0). In the figure below, AUC0-last integrate the shaded region. Integration after tlast is 0.

-
tlast <- pk.calc.tlast(conc=my_conc$conc,
-                       time=my_conc$time)
-tlast
+
tlast <- pk.calc.tlast(conc=my_conc$conc,
+                       time=my_conc$time)
+tlast
## [1] 8
-
my_conc$include_auclast <- my_conc$time <= tlast
-
ggplot(my_conc,
-       aes(x=time,
-           y=conc,
-           shape=BLOQ,
-           group=subject)) +
-  geom_ribbon(data=my_conc[my_conc$include_auclast,],
-              aes(ymin=0, ymax=conc),
-              fill="lightblue") +
-  geom_line() +
-  geom_point(size=4) +
-  scale_x_continuous(breaks=my_conc$time) +
-  theme(legend.position=c(0.8, 0.8))
-

+
my_conc$include_auclast <- my_conc$time <= tlast
+
ggplot(my_conc,
+       aes(x=time,
+           y=conc,
+           shape=BLQ,
+           group=subject)) +
+  geom_ribbon(data=my_conc[my_conc$include_auclast,],
+              aes(ymin=0, ymax=conc),
+              fill="lightblue") +
+  geom_line() +
+  geom_point(size=4) +
+  scale_x_continuous(breaks=my_conc$time) +
+  theme(legend.position=c(0.8, 0.8))
+

AUCall

AUCall starts with AUC0-last and then integrates from tlast to the first point after tlast with a linear interpolation to zero. From the second point after tlast to \(\infty\) is considered zero.

-
first_after_tlast <- my_conc$time[my_conc$time > tlast][1]
-first_after_tlast
+
first_after_tlast <- my_conc$time[my_conc$time > tlast][1]
+first_after_tlast
## [1] 12
-
my_conc$include_aucall <- my_conc$time <= first_after_tlast
-
ggplot(my_conc,
-       aes(x=time,
-           y=conc,
-           shape=BLOQ,
-           group=subject)) +
-  geom_ribbon(data=my_conc[my_conc$include_aucall,],
-              aes(ymin=0, ymax=conc),
-              fill="lightblue") +
-  geom_line() +
-  geom_point(size=4) +
-  scale_x_continuous(breaks=my_conc$time) +
-  theme(legend.position=c(0.8, 0.8))
-

+
my_conc$include_aucall <- my_conc$time <= first_after_tlast
+
ggplot(my_conc,
+       aes(x=time,
+           y=conc,
+           shape=BLQ,
+           group=subject)) +
+  geom_ribbon(data=my_conc[my_conc$include_aucall,],
+              aes(ymin=0, ymax=conc),
+              fill="lightblue") +
+  geom_line() +
+  geom_point(size=4) +
+  scale_x_continuous(breaks=my_conc$time) +
+  theme(legend.position=c(0.8, 0.8))
+

AUC to Infinity (AUC\(\infty\))

AUC0-\(\infty\) is commonly used for single-dose data. It calculates the AUC0-last and then extrapolates to \(\infty\) using the estimated half-life. Two starting points are used to estimate from tlast to \(\infty\), the observed or half-life predicted concentration at tlast (clast.obs and clast.pred).

-

The two figures below illustrate the integration with AUC0-\(\infty\),obs and AUC~0-\(\infty\),pred$. The difference between the tow figures is most evident at time=8 where there is a discontinuity in integration at tlast due to using clast.pred after that point and clast.obs before that point. (To illustrate the integration differences, BLOQ indicator shapes have been removed. BLOQ is handled identically to previous figures.)

-
# Add one row to illustrate extrapolation beyond observed data
-my_conc <-
-  rbind(my_conc,
-        data.frame(conc=NA,
-                   time=36,
-                   subject=1,
-                   BLOQ=NA,
-                   measured=FALSE,
-                   include_auclast=FALSE,
-                   include_aucall=FALSE))
-# Extrapolate concentrations for aucinf.obs
-my_conc$conc_aucinf.obs <- my_conc$conc
-my_conc$conc_aucinf.obs[my_conc$BLOQ | is.na(my_conc$BLOQ)] <-
-  interp.extrap.conc(conc=my_conc$conc,
-                     time=my_conc$time,
-                     time.out=my_conc$time[my_conc$BLOQ | is.na(my_conc$BLOQ)],
-                     lambda.z=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "lambda.z"])
-
-# Extrapolate concentrations for aucinf.pred
-my_conc$conc_aucinf.pred <- my_conc$conc
-my_conc$conc_aucinf.pred[my_conc$BLOQ | is.na(my_conc$BLOQ)] <-
-  interp.extrap.conc(conc=my_conc$conc,
-                     time=my_conc$time,
-                     time.out=my_conc$time[my_conc$BLOQ | is.na(my_conc$BLOQ)],
-                     lambda.z=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "lambda.z"],
-                     clast=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "clast.pred"])
-my_conc$conc_aucinf.pred[my_conc$time == tlast] <-
-  as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "clast.pred"]
-
ggplot(my_conc[!is.na(my_conc$conc),],
-       aes(x=time,
-           y=conc,
-           #shape=BLOQ,
-           group=subject)) +
-  geom_ribbon(data=my_conc,
-              aes(ymin=0, ymax=conc_aucinf.obs),
-              fill="lightblue") +
-  geom_line() +
-  #geom_point(size=2) +
-  scale_x_continuous(breaks=my_conc$time) +
-  theme(legend.position=c(0.8, 0.8)) +
-  labs(title="Extrapolation using AUCinf,obs")
+

The two figures below illustrate the integration with AUC0-\(\infty\),obs and AUC~0-\(\infty\),pred$. The difference between the tow figures is most evident at time=8 where there is a discontinuity in integration at tlast due to using clast.pred after that point and clast.obs before that point. (To illustrate the integration differences, BLQ indicator shapes have been removed. BLQ is handled identically to previous figures.)

+
# Add one row to illustrate extrapolation beyond observed data
+my_conc <-
+  rbind(my_conc,
+        data.frame(conc=NA,
+                   time=36,
+                   subject=1,
+                   BLQ=NA,
+                   measured=FALSE,
+                   include_auclast=FALSE,
+                   include_aucall=FALSE))
+# Extrapolate concentrations for aucinf.obs
+my_conc$conc_aucinf.obs <- my_conc$conc
+my_conc$conc_aucinf.obs[my_conc$BLQ | is.na(my_conc$BLQ)] <-
+  interp.extrap.conc(conc=my_conc$conc,
+                     time=my_conc$time,
+                     time.out=my_conc$time[my_conc$BLQ | is.na(my_conc$BLQ)],
+                     lambda.z=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "lambda.z"])
+
+# Extrapolate concentrations for aucinf.pred
+my_conc$conc_aucinf.pred <- my_conc$conc
+my_conc$conc_aucinf.pred[my_conc$BLQ | is.na(my_conc$BLQ)] <-
+  interp.extrap.conc(conc=my_conc$conc,
+                     time=my_conc$time,
+                     time.out=my_conc$time[my_conc$BLQ | is.na(my_conc$BLQ)],
+                     lambda.z=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "lambda.z"],
+                     clast=as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "clast.pred"])
+my_conc$conc_aucinf.pred[my_conc$time == tlast] <-
+  as.data.frame(results_obj)$PPORRES[as.data.frame(results_obj)$PPTESTCD %in% "clast.pred"]
+
ggplot(my_conc[!is.na(my_conc$conc),],
+       aes(x=time,
+           y=conc,
+           #shape=BLQ,
+           group=subject)) +
+  geom_ribbon(data=my_conc,
+              aes(ymin=0, ymax=conc_aucinf.obs),
+              fill="lightblue") +
+  geom_line() +
+  #geom_point(size=2) +
+  scale_x_continuous(breaks=my_conc$time) +
+  theme(legend.position=c(0.8, 0.8)) +
+  labs(title="Extrapolation using AUCinf,obs")

-
ggplot(my_conc[!is.na(my_conc$conc),],
-       aes(x=time,
-           y=conc,
-           #shape=BLOQ,
-           group=subject)) +
-  geom_ribbon(
-    data=arrange(
-      bind_rows(mutate(my_conc,
-                       before=FALSE),
-                mutate(filter(my_conc, time == tlast),
-                       conc_aucinf.pred=conc,
-                       before=TRUE)),
-      time, desc(before)),
-    aes(ymin=0,
-        ymax=conc_aucinf.pred),
-    fill="lightblue") +
-  geom_line() +
-  #geom_point(size=2) +
-  scale_x_continuous(breaks=my_conc$time) +
-  theme(legend.position=c(0.8, 0.8)) +
-  labs(title="Extrapolation using AUCinf,pred")
+
ggplot(my_conc[!is.na(my_conc$conc),],
+       aes(x=time,
+           y=conc,
+           #shape=BLQ,
+           group=subject)) +
+  geom_ribbon(
+    data=arrange(
+      bind_rows(mutate(my_conc,
+                       before=FALSE),
+                mutate(filter(my_conc, time == tlast),
+                       conc_aucinf.pred=conc,
+                       before=TRUE)),
+      time, desc(before)),
+    aes(ymin=0,
+        ymax=conc_aucinf.pred),
+    fill="lightblue") +
+  geom_line() +
+  #geom_point(size=2) +
+  scale_x_continuous(breaks=my_conc$time) +
+  theme(legend.position=c(0.8, 0.8)) +
+  labs(title="Extrapolation using AUCinf,pred")

Partial AUCs

Partial AUCs integrate part of the area within a time range of interest. Partial AUCs are often of interest to assess bioequivalence with more detail than AUC0-\(\infty\) or AUC0-last may indicate. Within PKNCA, partial AUCs are treated like AUClast with start and end times separately selected. (In a future version of PKNCA, they will be more simply calculated using an AUCinterval.)

When the starting and ending times are observed within the data, partial AUCs can be calculated using the parameter auclast as illustrated below.

-
# Interpolation not required
-data_obs_obj <- PKNCAdata(conc_obj, intervals=data.frame(start=0, end=2, auclast=TRUE))
-results_obs_obj <- pk.nca(data_obs_obj)
+
# Interpolation not required
+data_obs_obj <- PKNCAdata(conc_obj, intervals=data.frame(start=0, end=2, auclast=TRUE))
+results_obs_obj <- pk.nca(data_obs_obj)
## No dose information provided, calculations requiring dose will return NA.
-
kable(as.data.frame(results_obs_obj))
+
kable(as.data.frame(results_obs_obj))
subject start endsubject PPTESTCD PPORRES exclude
1 0 241 auclast 12.9965842 NA
1 0 241 aucall 15.1965842 NA
1 0 241 tmax 2.0000000 NA
1 0 241 tlast 8.0000000 NA
1 0 241 clast.obs 1.1000000 NA
1 0 241 lambda.z 0.1075592 NA
1 0 241 r.squared 0.7580245 NA
1 0 241 adj.r.squared 0.6370368 NA
1 0 241 lambda.z.time.first 3.0000000 NA
1 0 241 lambda.z.n.points 4.0000000 NA
1 0 241 clast.pred 1.0216136 NA
1 0 241 half.life 6.4443313 NA
1 0 241 span.ratio 0.7758757 NA
1 0 241 aucinf.obs 23.2235095 NA
1 0 241 aucinf.pred 22.4947355 NA
+ - @@ -627,9 +463,9 @@

Partial AUCs

+ - @@ -637,23 +473,34 @@

Partial AUCs

subject start endsubject PPTESTCD PPORRES exclude
1 0 21 auclast 4 NA

When the starting and ending times are not observed within the data or when samples are below the limit of quantification, concentrations must be interpolated and added to the dataset before calculation as illustrated below.

-
# Interpolation required
-my_conc_interp <-
-  arrange(
-    bind_rows(
-      my_conc,
-      data.frame(conc=interp.extrap.conc(conc=my_conc$conc, time=my_conc$time, time.out=1.5),
-                 time=1.5,
-                 subject=1)),
-    time)
-kable(my_conc_interp)
+
# Interpolation required
+my_conc_interp <-
+  arrange(
+    bind_rows(
+      my_conc,
+      data.frame(conc=interp.extrap.conc(conc=my_conc$conc, time=my_conc$time, time.out=1.5),
+                 time=1.5,
+                 subject=1)),
+    time)
+kable(my_conc_interp)
+++++++++++ - + @@ -785,13 +632,15 @@

Partial AUCs

conc time subjectBLOQBLQ measured include_auclast include_aucall
-
conc_interp_obj <- PKNCAconc(my_conc_interp, conc~time|subject)
-data_interp_obj <- PKNCAdata(conc_interp_obj, intervals=data.frame(start=0, end=1.5, auclast=TRUE))
-results_interp <- pk.nca(data_interp_obj)
+
conc_interp_obj <- PKNCAconc(my_conc_interp, conc~time|subject)
+data_interp_obj <- PKNCAdata(conc_interp_obj, intervals=data.frame(start=0, end=1.5, auclast=TRUE))
+results_interp <- pk.nca(data_interp_obj)
## No dose information provided, calculations requiring dose will return NA.
-
as.data.frame(results_interp)
-
##   start end subject PPTESTCD PPORRES exclude
-## 1     0 1.5       1  auclast  2.5625    <NA>
+
as.data.frame(results_interp)
+
## # A tibble: 1 x 6
+##   subject start   end PPTESTCD PPORRES exclude
+##     <dbl> <dbl> <dbl> <chr>      <dbl> <chr>  
+## 1       1     0   1.5 auclast     2.56 <NA>
diff --git a/doc/Example-theophylline.html b/doc/Example-theophylline.html index c5bea88b..9f2ab18d 100644 --- a/doc/Example-theophylline.html +++ b/doc/Example-theophylline.html @@ -1,38 +1,54 @@ - + - - + Computing NCA Parameters for Theophylline + + - + + + @@ -319,8 +154,8 @@

Bill Denney

Examples simplify understanding. Below is an example of how to use the theophylline dataset to generate NCA parameters.

Load the data

-
## It is always a good idea to look at the data
-knitr::kable(head(datasets::Theoph))
+
## It is always a good idea to look at the data
+knitr::kable(head(datasets::Theoph))
@@ -377,20 +212,20 @@

Load the data

The columns that we will be interested in for our analysis are conc, Time, and Subject in the concentration data set and Dose, Time, and Subject for the dosing data set.

-
## By default it is groupedData; convert it to a data frame for use
-conc_obj <- PKNCAconc(as.data.frame(datasets::Theoph), conc~Time|Subject)
-
-## Dosing data needs to only have one row per dose, so subset for
-## that first.
-d_dose <- unique(datasets::Theoph[datasets::Theoph$Time == 0,
-                                  c("Dose", "Time", "Subject")])
-knitr::kable(d_dose,
-             caption="Example dosing data extracted from theophylline data set")
+
## By default it is groupedData; convert it to a data frame for use
+conc_obj <- PKNCAconc(as.data.frame(datasets::Theoph), conc~Time|Subject)
+
+## Dosing data needs to only have one row per dose, so subset for
+## that first.
+d_dose <- unique(datasets::Theoph[datasets::Theoph$Time == 0,
+                                  c("Dose", "Time", "Subject")])
+knitr::kable(d_dose,
+             caption="Example dosing data extracted from theophylline data set")
- + @@ -398,87 +233,187 @@

Load the data

- + - + - + - + - + - + - + - + - + - + - + - +
Example dosing data extracted from theophylline data set
Dose Time Subject
11 4.02 0 1
1212 4.40 0 2
2323 4.53 0 3
3434 4.40 0 4
4545 5.86 0 5
5656 4.00 0 6
6767 4.95 0 7
7878 4.53 0 8
8989 3.10 0 9
100100 5.50 0 10
111111 4.92 0 11
122122 5.30 0 12
-
dose_obj <- PKNCAdose(d_dose, Dose~Time|Subject)
+
dose_obj <- PKNCAdose(d_dose, Dose~Time|Subject)

Merge the Concentration and Dose

After loading the data, they must be combined to prepare for parameter calculation. Intervals for calculation will automatically be selected based on the single.dose.aucs setting in PKNCA.options

-
data_obj_automatic <- PKNCAdata(conc_obj, dose_obj)
-knitr::kable(PKNCA.options("single.dose.aucs"))
- +
data_obj_automatic <- PKNCAdata(conc_obj, dose_obj)
+knitr::kable(PKNCA.options("single.dose.aucs"))
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -520,6 +455,7 @@

Merge the Concentration and Dose

+ @@ -679,6 +615,7 @@

Merge the Concentration and Dose

+ @@ -720,6 +657,7 @@

Merge the Concentration and Dose

+ @@ -781,8 +719,109 @@

Merge the Concentration and Dose

start clr.obs clr.pred fetime_above half.life r.squared adj.r.squared FALSE FALSE FALSEFALSE
0 FALSE FALSE FALSEFALSE TRUE FALSE FALSE
-
knitr::kable(data_obj_automatic$intervals)
- +
knitr::kable(data_obj_automatic$intervals)
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -824,6 +863,7 @@

Merge the Concentration and Dose

+ @@ -984,6 +1024,7 @@

Merge the Concentration and Dose

+ @@ -1026,6 +1067,7 @@

Merge the Concentration and Dose

+ @@ -1184,6 +1226,7 @@

Merge the Concentration and Dose

+ @@ -1226,6 +1269,7 @@

Merge the Concentration and Dose

+ @@ -1384,6 +1428,7 @@

Merge the Concentration and Dose

+ @@ -1426,6 +1471,7 @@

Merge the Concentration and Dose

+ @@ -1584,6 +1630,7 @@

Merge the Concentration and Dose

+ @@ -1626,6 +1673,7 @@

Merge the Concentration and Dose

+ @@ -1784,6 +1832,7 @@

Merge the Concentration and Dose

+ @@ -1826,6 +1875,7 @@

Merge the Concentration and Dose

+ @@ -1984,6 +2034,7 @@

Merge the Concentration and Dose

+ @@ -2026,6 +2077,7 @@

Merge the Concentration and Dose

+ @@ -2184,6 +2236,7 @@

Merge the Concentration and Dose

+ @@ -2226,6 +2279,7 @@

Merge the Concentration and Dose

+ @@ -2384,6 +2438,7 @@

Merge the Concentration and Dose

+ @@ -2426,6 +2481,7 @@

Merge the Concentration and Dose

+ @@ -2584,6 +2640,7 @@

Merge the Concentration and Dose

+ @@ -2626,6 +2683,7 @@

Merge the Concentration and Dose

+ @@ -2784,6 +2842,7 @@

Merge the Concentration and Dose

+ @@ -2826,6 +2885,7 @@

Merge the Concentration and Dose

+ @@ -2984,6 +3044,7 @@

Merge the Concentration and Dose

+ @@ -3026,6 +3087,7 @@

Merge the Concentration and Dose

+ @@ -3184,6 +3246,7 @@

Merge the Concentration and Dose

+ @@ -3226,6 +3289,7 @@

Merge the Concentration and Dose

+ @@ -3288,17 +3352,117 @@

Merge the Concentration and Dose

start clr.obs clr.pred fetime_above half.life r.squared adj.r.squared FALSE FALSE FALSEFALSE 1
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 2
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 3
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 4
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 5
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 6
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 7
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 8
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 9
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 10
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 11
FALSE FALSE FALSEFALSE TRUE FALSE FALSE FALSE FALSE FALSEFALSE 12
FALSE FALSE FALSEFALSE TRUE FALSE FALSE
-

Intervals for calculation can also be specified manually. Manual specification requires at least columns for start time, end time, and the parameters requested. The manual specification can also include any grouping factors from the concentration data set. Column order of the intervals is not important. When intervals are manually specified, they are expanded to the full interval set when added to a PKNCAdata object (in other words, a column is created for each parameter. Also, PKNCA automatically calculates parameters required for the NCA, so while lambda.z is required for calculating AUC0-\(\infinity\), you do not have to specify it in the parameters requested.

-
intervals_manual <- data.frame(start=0,
-                               end=Inf,
-                               cmax=TRUE,
-                               tmax=TRUE,
-                               aucinf.obs=TRUE,
-                               auclast=TRUE)
-data_obj_manual <- PKNCAdata(conc_obj, dose_obj,
-                             intervals=intervals_manual)
-knitr::kable(data_obj_manual$intervals)
- +

Intervals for calculation can also be specified manually. Manual specification requires at least columns for start time, end time, and the parameters requested. The manual specification can also include any grouping factors from the concentration data set. Column order of the intervals is not important. When intervals are manually specified, they are expanded to the full interval set when added to a PKNCAdata object (in other words, a column is created for each parameter. Also, PKNCA automatically calculates parameters required for the NCA, so while lambda.z is required for calculating AUC0-\(\infty\), you do not have to specify it in the parameters requested.

+
intervals_manual <- data.frame(start=0,
+                               end=Inf,
+                               cmax=TRUE,
+                               tmax=TRUE,
+                               aucinf.obs=TRUE,
+                               auclast=TRUE)
+data_obj_manual <- PKNCAdata(conc_obj, dose_obj,
+                             intervals=intervals_manual)
+knitr::kable(data_obj_manual$intervals)
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -3340,6 +3504,7 @@

Merge the Concentration and Dose

+ @@ -3459,6 +3624,7 @@

Merge the Concentration and Dose

+ @@ -3506,14 +3672,14 @@

Merge the Concentration and Dose

Compute the parameters

Parameter calculation will automatically split the data by the grouping factor(s), subset by the interval, calculate all required parameters, record all options used for the calculations, and include data provenance to show that the calculation was performed as described. For all this, just call the pk.nca function with your PKNCAdata object.

-
results_obj_automatic <- pk.nca(data_obj_automatic)
-knitr::kable(head(as.data.frame(results_obj_automatic)))
+
results_obj_automatic <- pk.nca(data_obj_automatic)
+knitr::kable(head(as.data.frame(results_obj_automatic)))
start clr.obs clr.pred fetime_above half.life r.squared adj.r.squared FALSE FALSE FALSEFALSE TRUE FALSE FALSE
+ - @@ -3521,56 +3687,56 @@

Compute the parameters

+ - + - + - + - + - + -
Subject start endSubject PPTESTCD PPORRES exclude
1 0 241 auclast 92.365442 NA
1 0 Inf1 cmax 10.500000 NA
1 0 Inf1 tmax 1.120000 NA
1 0 Inf1 tlast 24.370000 NA
1 0 Inf1 clast.obs 3.280000 NA
1 0 Inf1 lambda.z 0.048457 NA
-
summary(results_obj_automatic)
+
summary(results_obj_automatic)
@@ -3607,14 +3773,14 @@

Compute the parameters

-
results_obj_manual <- pk.nca(data_obj_manual)
-knitr::kable(head(as.data.frame(results_obj_manual)))
+
results_obj_manual <- pk.nca(data_obj_manual)
+knitr::kable(head(as.data.frame(results_obj_manual)))
+ - @@ -3622,56 +3788,56 @@

Compute the parameters

+ - - + + - - + + - - + + - - + + - - + + - - +
Subject start endSubject PPTESTCD PPORRES exclude
6 0 Inf1 auclast147.23474871.6970150 NA
6 0 Inf1 cmax10.5000006.4400000 NA
6 0 Inf1 tmax1.1200001.1500000 NA
6 0 Inf1 tlast24.37000023.8500000 NA
6 0 Inf1 clast.obs3.2800000.9200000 NA
6 0 Inf1 lambda.z0.0484570.0877957 NA
-
summary(results_obj_manual)
+
summary(results_obj_manual)
@@ -3701,16 +3867,16 @@

Compute the parameters

Multiple Dose Example

Assessing multiple dose pharmacokinetics is conceptually the same as single-dose in PKNCA.

To assess multiple dose PK, the theophylline data will be extended from single to multiple doses using superposition (see the Superposition vignette for more information).

-
d_conc <- PKNCAconc(as.data.frame(Theoph), conc~Time|Subject)
-conc_obj_multi <-
-  PKNCAconc(
-    superposition(d_conc,
-                  tau=168,
-                  dose.times=seq(0, 144, by=24),
-                  n.tau=1,
-                  check.blq=FALSE),
-    conc~time|Subject)
-conc_obj_multi
+
d_conc <- PKNCAconc(as.data.frame(Theoph), conc~Time|Subject)
+conc_obj_multi <-
+  PKNCAconc(
+    superposition(d_conc,
+                  tau=168,
+                  dose.times=seq(0, 144, by=24),
+                  n.tau=1,
+                  check.blq=FALSE),
+    conc~time|Subject)
+conc_obj_multi
## Formula for concentration:
 ##  conc ~ time | Subject
 ## With 12 subjects defined in the 'Subject' column.
@@ -3724,10 +3890,10 @@ 

Multiple Dose Example

## 1 6.57000 0.57 <NA> NA 0 ## 1 10.50000 1.12 <NA> NA 0 ## 1 9.66000 2.02 <NA> NA 0
-
dose_obj_multi <- PKNCAdose(expand.grid(Subject=unique(conc_obj_multi$data$Subject),
-                                      time=seq(0, 144, by=24)),
-                          ~time|Subject)
-dose_obj_multi
+
dose_obj_multi <- PKNCAdose(expand.grid(Subject=unique(conc_obj_multi$data$Subject),
+                                      time=seq(0, 144, by=24)),
+                          ~time|Subject)
+dose_obj_multi
## Formula for dosing:
 ##  ~time | Subject
 ## Nominal time column is not specified.
@@ -3741,199 +3907,93 @@ 

Multiple Dose Example

## 5 0 <NA> extravascular 0 ## 6 0 <NA> extravascular 0

The superposition-simulated scenario is not especially realistic as it includes dense sampling on every day. With this scenario, the intervals automatically selected have an interval for every subject on every day.

-
data_obj <- PKNCAdata(conc_obj_multi, dose_obj_multi)
-data_obj$intervals[,c("Subject", "start", "end")]
-
##    Subject start end
-## 1        1     0  24
-## 2        1    24  48
-## 3        1    48  72
-## 4        1    72  96
-## 5        1    96 120
-## 6        1   120 144
-## 7        1   144 168
-## 8        2     0  24
-## 9        2    24  48
-## 10       2    48  72
-## 11       2    72  96
-## 12       2    96 120
-## 13       2   120 144
-## 14       2   144 168
-## 15       3     0  24
-## 16       3    24  48
-## 17       3    48  72
-## 18       3    72  96
-## 19       3    96 120
-## 20       3   120 144
-## 21       3   144 168
-## 22       4     0  24
-## 23       4    24  48
-## 24       4    48  72
-## 25       4    72  96
-## 26       4    96 120
-## 27       4   120 144
-## 28       4   144 168
-## 29       5     0  24
-## 30       5    24  48
-## 31       5    48  72
-## 32       5    72  96
-## 33       5    96 120
-## 34       5   120 144
-## 35       5   144 168
-## 36       6     0  24
-## 37       6    24  48
-## 38       6    48  72
-## 39       6    72  96
-## 40       6    96 120
-## 41       6   120 144
-## 42       6   144 168
-## 43       7     0  24
-## 44       7    24  48
-## 45       7    48  72
-## 46       7    72  96
-## 47       7    96 120
-## 48       7   120 144
-## 49       7   144 168
-## 50       8     0  24
-## 51       8    24  48
-## 52       8    48  72
-## 53       8    72  96
-## 54       8    96 120
-## 55       8   120 144
-## 56       8   144 168
-## 57       9     0  24
-## 58       9    24  48
-## 59       9    48  72
-## 60       9    72  96
-## 61       9    96 120
-## 62       9   120 144
-## 63       9   144 168
-## 64      10     0  24
-## 65      10    24  48
-## 66      10    48  72
-## 67      10    72  96
-## 68      10    96 120
-## 69      10   120 144
-## 70      10   144 168
-## 71      11     0  24
-## 72      11    24  48
-## 73      11    48  72
-## 74      11    72  96
-## 75      11    96 120
-## 76      11   120 144
-## 77      11   144 168
-## 78      12     0  24
-## 79      12    24  48
-## 80      12    48  72
-## 81      12    72  96
-## 82      12    96 120
-## 83      12   120 144
-## 84      12   144 168
+
data_obj <- PKNCAdata(conc_obj_multi, dose_obj_multi)
+data_obj$intervals[,c("Subject", "start", "end")]
+
## # A tibble: 84 x 3
+##    Subject start   end
+##    <ord>   <dbl> <dbl>
+##  1 1           0    24
+##  2 1          24    48
+##  3 1          48    72
+##  4 1          72    96
+##  5 1          96   120
+##  6 1         120   144
+##  7 1         144   168
+##  8 2           0    24
+##  9 2          24    48
+## 10 2          48    72
+## # ... with 74 more rows

In a more realistic scenario, dense PK sampling occurs for every subject on the first and last days. To select those intervals manually, specify the intervals of interest in the intervals argument to the PKNCAdata function call. The intervals are automatically expanded not to calculate anything that was not requested.

-
intervals_manual <- data.frame(start=c(0, 144),
-                               end=c(24, 168),
-                               cmax=TRUE,
-                               auclast=TRUE)
-data_obj <- PKNCAdata(conc_obj_multi, dose_obj_multi,
-                      intervals=intervals_manual)
-data_obj$intervals
+
intervals_manual <- data.frame(start=c(0, 144),
+                               end=c(24, 168),
+                               cmax=TRUE,
+                               auclast=TRUE)
+data_obj <- PKNCAdata(conc_obj_multi, dose_obj_multi,
+                      intervals=intervals_manual)
+data_obj$intervals
##   start end auclast aucall aumclast aumcall aucint.last aucint.last.dose
 ## 1     0  24    TRUE  FALSE    FALSE   FALSE       FALSE            FALSE
 ## 2   144 168    TRUE  FALSE    FALSE   FALSE       FALSE            FALSE
-##   aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn
-## 1      FALSE           FALSE      FALSE     FALSE       FALSE      FALSE
-## 2      FALSE           FALSE      FALSE     FALSE       FALSE      FALSE
-##   cmax  cmin  tmax tlast tfirst clast.obs cl.last cl.all     f mrt.last
-## 1 TRUE FALSE FALSE FALSE  FALSE     FALSE   FALSE  FALSE FALSE    FALSE
-## 2 TRUE FALSE FALSE FALSE  FALSE     FALSE   FALSE  FALSE FALSE    FALSE
-##   mrt.iv.last vss.last vss.iv.last   cav ctrough   ptr  tlag deg.fluc
-## 1       FALSE    FALSE       FALSE FALSE   FALSE FALSE FALSE    FALSE
-## 2       FALSE    FALSE       FALSE FALSE   FALSE FALSE FALSE    FALSE
-##   swing  ceoi    ae clr.last clr.obs clr.pred    fe half.life r.squared
-## 1 FALSE FALSE FALSE    FALSE   FALSE    FALSE FALSE     FALSE     FALSE
-## 2 FALSE FALSE FALSE    FALSE   FALSE    FALSE FALSE     FALSE     FALSE
-##   adj.r.squared lambda.z lambda.z.time.first lambda.z.n.points clast.pred
-## 1         FALSE    FALSE               FALSE             FALSE      FALSE
-## 2         FALSE    FALSE               FALSE             FALSE      FALSE
-##   span.ratio cmax.dn cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn
-## 1      FALSE   FALSE   FALSE        FALSE         FALSE  FALSE      FALSE
-## 2      FALSE   FALSE   FALSE        FALSE         FALSE  FALSE      FALSE
-##   thalf.eff.last thalf.eff.iv.last kel.last kel.iv.last aucinf.obs
-## 1          FALSE             FALSE    FALSE       FALSE      FALSE
-## 2          FALSE             FALSE    FALSE       FALSE      FALSE
-##   aucinf.pred aumcinf.obs aumcinf.pred aucint.inf.obs aucint.inf.obs.dose
-## 1       FALSE       FALSE        FALSE          FALSE               FALSE
-## 2       FALSE       FALSE        FALSE          FALSE               FALSE
-##   aucint.inf.pred aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn
-## 1           FALSE                FALSE         FALSE          FALSE
-## 2           FALSE                FALSE         FALSE          FALSE
-##   aumcinf.obs.dn aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred
-## 1          FALSE           FALSE       FALSE        FALSE  FALSE   FALSE
-## 2          FALSE           FALSE       FALSE        FALSE  FALSE   FALSE
-##   mrt.obs mrt.pred mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs
-## 1   FALSE    FALSE      FALSE       FALSE      FALSE       FALSE  FALSE
-## 2   FALSE    FALSE      FALSE       FALSE      FALSE       FALSE  FALSE
-##   vz.pred vss.obs vss.pred vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred
-## 1   FALSE   FALSE    FALSE      FALSE       FALSE      FALSE       FALSE
-## 2   FALSE   FALSE    FALSE      FALSE       FALSE      FALSE       FALSE
-##   vd.obs vd.pred thalf.eff.obs thalf.eff.pred thalf.eff.iv.obs
-## 1  FALSE   FALSE         FALSE          FALSE            FALSE
-## 2  FALSE   FALSE         FALSE          FALSE            FALSE
-##   thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs kel.iv.pred
-## 1             FALSE   FALSE    FALSE      FALSE       FALSE
-## 2             FALSE   FALSE    FALSE      FALSE       FALSE
+## aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn cmax +## 1 FALSE FALSE FALSE FALSE FALSE FALSE TRUE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE TRUE +## cmin tmax tlast tfirst clast.obs cl.last cl.all f mrt.last mrt.iv.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.last vss.iv.last cav ctrough ptr tlag deg.fluc swing ceoi ae +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## clr.last clr.obs clr.pred fe time_above half.life r.squared adj.r.squared +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## lambda.z lambda.z.time.first lambda.z.n.points clast.pred span.ratio cmax.dn +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn thalf.eff.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.iv.last kel.last kel.iv.last aucinf.obs aucinf.pred aumcinf.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## aumcinf.pred aucint.inf.obs aucint.inf.obs.dose aucint.inf.pred +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn aumcinf.obs.dn +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred mrt.obs mrt.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs vz.pred vss.obs vss.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred vd.obs vd.pred thalf.eff.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.pred thalf.eff.iv.obs thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## kel.iv.pred +## 1 FALSE +## 2 FALSE

After the data is ready, the calculations and summary can progress.

-
results_obj <- pk.nca(data_obj)
-print(results_obj)
+
results_obj <- pk.nca(data_obj)
+print(results_obj)
## $result
-##    start end Subject PPTESTCD    PPORRES exclude
-## 1      0  24       1  auclast 151.189916    <NA>
-## 2      0  24       1     cmax  10.500000    <NA>
-## 3    144 168       1  auclast 214.860975    <NA>
-## 4    144 168       1     cmax  15.096727    <NA>
-## 5      0  24       2  auclast  88.457261    <NA>
-## 6      0  24       2     cmax   8.330000    <NA>
-## 7    144 168       2  auclast  97.381127    <NA>
-## 8    144 168       2     cmax   9.221742    <NA>
-## 9      0  24       3  auclast  95.698098    <NA>
-## 10     0  24       3     cmax   8.200000    <NA>
-## 11   144 168       3  auclast 106.131322    <NA>
-## 12   144 168       3     cmax   9.252474    <NA>
-## 13     0  24       4  auclast 101.860775    <NA>
-## 14     0  24       4     cmax   8.600000    <NA>
-## 15   144 168       4  auclast 114.219220    <NA>
-## 16   144 168       4     cmax   9.815170    <NA>
-## 17     0  24       5  auclast 117.621805    <NA>
-## 18     0  24       5     cmax  11.400000    <NA>
-## 19   144 168       5  auclast 136.309916    <NA>
-## 20   144 168       5     cmax  13.096191    <NA>
-## 21     0  24       6  auclast  71.834110    <NA>
-## 22     0  24       6     cmax   6.440000    <NA>
-## 23   144 168       6  auclast  82.177601    <NA>
-## 24   144 168       6     cmax   7.374375    <NA>
-## 25     0  24       7  auclast  89.021716    <NA>
-## 26     0  24       7     cmax   7.090000    <NA>
-## 27   144 168       7  auclast 100.992404    <NA>
-## 28   144 168       7     cmax   8.069847    <NA>
-## 29     0  24       8  auclast  86.655906    <NA>
-## 30     0  24       8     cmax   7.560000    <NA>
-## 31   144 168       8  auclast 102.163105    <NA>
-## 32   144 168       8     cmax   8.807391    <NA>
-## 33     0  24       9  auclast  83.447367    <NA>
-## 34     0  24       9     cmax   9.030000    <NA>
-## 35   144 168       9  auclast  97.525881    <NA>
-## 36   144 168       9     cmax  10.308349    <NA>
-## 37     0  24      10  auclast 136.329998    <NA>
-## 38     0  24      10     cmax  10.210000    <NA>
-## 39   144 168      10  auclast 167.865640    <NA>
-## 40   144 168      10     cmax  12.382817    <NA>
-## 41     0  24      11  auclast  77.824409    <NA>
-## 42     0  24      11     cmax   8.000000    <NA>
-## 43   144 168      11  auclast  86.903095    <NA>
-## 44   144 168      11     cmax   8.878024    <NA>
-## 45     0  24      12  auclast 115.043218    <NA>
-## 46     0  24      12     cmax   9.750000    <NA>
-## 47   144 168      12  auclast 125.838198    <NA>
-## 48   144 168      12     cmax  10.746939    <NA>
+## # A tibble: 48 x 6
+##    Subject start   end PPTESTCD PPORRES exclude
+##    <ord>   <dbl> <dbl> <chr>      <dbl> <chr>  
+##  1 6           0    24 auclast    71.8  <NA>   
+##  2 6           0    24 cmax        6.44 <NA>   
+##  3 6         144   168 auclast    82.2  <NA>   
+##  4 6         144   168 cmax        7.37 <NA>   
+##  5 7           0    24 auclast    89.0  <NA>   
+##  6 7           0    24 cmax        7.09 <NA>   
+##  7 7         144   168 auclast   101.   <NA>   
+##  8 7         144   168 cmax        8.07 <NA>   
+##  9 8           0    24 auclast    86.7  <NA>   
+## 10 8           0    24 cmax        7.56 <NA>   
+## # ... with 38 more rows
 ## 
 ## $data
 ## Formula for concentration:
@@ -3950,17 +4010,17 @@ 

Multiple Dose Example

## 1 10.50000 1.12 <NA> NA 0 ## 1 9.66000 2.02 <NA> NA 0 ## Formula for dosing: -## timeX ~ (time | Subject) +## ~time | Subject ## Nominal time column is not specified. ## ## First 6 rows of dosing data: -## Subject time exclude route duration timeX -## 1 0 <NA> extravascular 0 NA -## 2 0 <NA> extravascular 0 NA -## 3 0 <NA> extravascular 0 NA -## 4 0 <NA> extravascular 0 NA -## 5 0 <NA> extravascular 0 NA -## 6 0 <NA> extravascular 0 NA +## Subject time exclude route duration +## 1 0 <NA> extravascular 0 +## 2 0 <NA> extravascular 0 +## 3 0 <NA> extravascular 0 +## 4 0 <NA> extravascular 0 +## 5 0 <NA> extravascular 0 +## 6 0 <NA> extravascular 0 ## ## With 2 rows of AUC specifications. ## Options changed from default are: @@ -3973,6 +4033,9 @@

Multiple Dose Example

## $auc.method ## [1] "lin up/log down" ## +## $conc_above +## [1] NA +## ## $conc.na ## [1] "drop" ## @@ -4012,48 +4075,48 @@

Multiple Dose Example

## start end auclast aucall aumclast aumcall aucint.last aucint.last.dose ## 1 0 24 TRUE FALSE FALSE FALSE FALSE FALSE ## 2 0 Inf FALSE FALSE FALSE FALSE FALSE FALSE -## aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn -## 1 FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE -## cmax cmin tmax tlast tfirst clast.obs cl.last cl.all f mrt.last -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## mrt.iv.last vss.last vss.iv.last cav ctrough ptr tlag deg.fluc -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## swing ceoi ae clr.last clr.obs clr.pred fe half.life r.squared -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE -## adj.r.squared lambda.z lambda.z.time.first lambda.z.n.points clast.pred -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## span.ratio cmax.dn cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## thalf.eff.last thalf.eff.iv.last kel.last kel.iv.last aucinf.obs -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE TRUE -## aucinf.pred aumcinf.obs aumcinf.pred aucint.inf.obs aucint.inf.obs.dose -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## aucint.inf.pred aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn -## 1 FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE -## aumcinf.obs.dn aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred -## 1 FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE -## mrt.obs mrt.pred mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## vz.pred vss.obs vss.pred vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## vd.obs vd.pred thalf.eff.obs thalf.eff.pred thalf.eff.iv.obs -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs kel.iv.pred -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE +## aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn cmax +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE TRUE +## cmin tmax tlast tfirst clast.obs cl.last cl.all f mrt.last mrt.iv.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.last vss.iv.last cav ctrough ptr tlag deg.fluc swing ceoi ae +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## clr.last clr.obs clr.pred fe time_above half.life r.squared adj.r.squared +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE +## lambda.z lambda.z.time.first lambda.z.n.points clast.pred span.ratio cmax.dn +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn thalf.eff.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.iv.last kel.last kel.iv.last aucinf.obs aucinf.pred aumcinf.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE TRUE FALSE FALSE +## aumcinf.pred aucint.inf.obs aucint.inf.obs.dose aucint.inf.pred +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn aumcinf.obs.dn +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred mrt.obs mrt.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs vz.pred vss.obs vss.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred vd.obs vd.pred thalf.eff.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.pred thalf.eff.iv.obs thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## kel.iv.pred +## 1 FALSE +## 2 FALSE ## ## ## $exclude @@ -4062,8 +4125,8 @@

Multiple Dose Example

## attr(,"class") ## [1] "PKNCAresults" "list" ## attr(,"provenance") -## Provenance hash 51b59f882a9f3a2811324a5ff10bb22b generated on 2019-09-19 12:55:47 with R version 3.6.1 (2019-07-05).
-
summary(results_obj)
+## Provenance hash ee687a520af821aa354fef62aa53cba0 generated on 2021-10-29 14:18:10 with R version 4.1.0 (2021-05-18). +
summary(results_obj)
##  start end  N     auclast        cmax
 ##      0  24 12 98.8 [23.0] 8.65 [17.0]
 ##    144 168 12  115 [28.4] 10.0 [21.0]
diff --git a/doc/Half-Life-Calculation.html b/doc/Half-Life-Calculation.html
new file mode 100644
index 00000000..814726b1
--- /dev/null
+++ b/doc/Half-Life-Calculation.html
@@ -0,0 +1,332 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Half-Life Calculation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Half-Life Calculation

+

Bill Denney

+ + + + +
+

Introduction

+

Half-life is calculated by fitting the natural logarithm of concentration by time. The default calculation method is curve stripping (described in more detail below). Manual half-life points with no automated half-life selection can be performed, or specific points can be excluded while still performing curve stripping.

+
+
+

Curve Stripping Method

+

When automatic point selection is performed for curve stripping, the algorithm described below is used.

+
+

Select the Points

+

All sets of points that are applicable according to the current options are selected.

+
    +
  • Drop all BLQ values, then
  • +
  • Choose all sets of points that start from the \(T_{last}\) and step back: +
      +
    • at least 3 points (customizable with PKNCA.options("min.hl.points"))
    • +
    • Not including \(T_{max}\) (customizable with PKNCA.options("allow.tmax.in.half.life"))
    • +
  • +
+

As a specific example, if measurements were at 0, 1, 2, 3, 4, 6, 8, 12, and 24 hours; if \(T_{last}\) is 12 hours; and if \(T_{max}\) is 1 hour then the default point sets that would be fit are:

+
    +
  1. 6, 8, and 12 hours;
  2. +
  3. 4, 6, 8, and 12 hours;
  4. +
  5. 3, 4, 6, 8, and 12 hours; and
  6. +
  7. 2, 3, 4, 6, 8, and 12 hours.
  8. +
+

If PKNCA.options("min.hl.points") were set to 4, then the 6, 8, and 12 hour set would not be fit. If PKNCA.options("allow.tmax.in.half.life") were set to TRUE, then 1, 2, 3, 4, 6, 8, and 12 hours would be fit.

+
+
+

Select the Best Fit

+

After fitting all points, the best fit among the set of possible fit is selected by the following rules:

+
    +
  1. \(\lambda_z > 0\) and at the same time the maximum r-squared must be within an adjusted \(r^2\) factor of the best. +
      +
    1. The adjusted \(r^2\) factor is controlled by PKNCA.options("adj.r.squared.factor") and it defaults to 10^{-4}.
    2. +
    3. These rules must be met simultaneously, so if the maximum adjusted \(r^2\) is for a line with \(\lambda_z \leq 0\), the half-life may end up being unreportable.
    4. +
  2. +
  3. If fitting the log-linear concentration-time line fails, then it is not the best line.
  4. +
  5. If more than one fit still meets the criteria above, then choose the fit with the most points included.
  6. +
+
+
+

Example

+
# Perform calculations for subject 1, only
+data_conc <- as.data.frame(datasets::Theoph)[datasets::Theoph$Subject == 1, ]
+
+# Keep all points
+conc_obj <-
+  PKNCAconc(
+    data_conc,
+    conc~Time|Subject
+  )
+
+# Only calculate half-life and parameters required for half-life
+current_intervals <- data.frame(start=0, end=Inf, half.life=TRUE)
+data_obj <- PKNCAdata(conc_obj, intervals=current_intervals)
+result_obj <- pk.nca(data_obj)
+
## No dose information provided, calculations requiring dose will return NA.
+
# Extract the results for subject 1 
+as.data.frame(result_obj)
+
## # A tibble: 10 x 6
+##    Subject start   end PPTESTCD            PPORRES exclude
+##    <ord>   <dbl> <dbl> <chr>                 <dbl> <chr>  
+##  1 1           0   Inf tmax                 1.12   <NA>   
+##  2 1           0   Inf tlast               24.4    <NA>   
+##  3 1           0   Inf lambda.z             0.0485 <NA>   
+##  4 1           0   Inf r.squared            1.00   <NA>   
+##  5 1           0   Inf adj.r.squared        1.00   <NA>   
+##  6 1           0   Inf lambda.z.time.first  9.05   <NA>   
+##  7 1           0   Inf lambda.z.n.points    3      <NA>   
+##  8 1           0   Inf clast.pred           3.28   <NA>   
+##  9 1           0   Inf half.life           14.3    <NA>   
+## 10 1           0   Inf span.ratio           1.07   <NA>
+
+
+
+

Manual Point Selection

+
+

Exclusion of Specific Points with Curve Stripping

+

In some cases, specific points will be known outliers, or there may be another reason to exclude specific points. And, with those points excluded, the half-life should be calculated using the normal curve stripping methods described above.

+

To exclude specific points but otherwise use curve stripping, use the exclude_half.life option as the column name in the concentration dataset for PKNCAconc() as illustrated below.

+
data_conc$exclude_hl <- data_conc$Time == 12.12
+# Confirm that we will be excluding exactly one point
+stopifnot(sum(data_conc$exclude_hl) == 1)
+
+# Drop one point
+conc_obj_exclude1 <-
+  PKNCAconc(
+    data_conc,
+    conc~Time|Subject,
+    exclude_half.life="exclude_hl"
+  )
+
+data_obj_exclude1 <- PKNCAdata(conc_obj_exclude1, intervals=current_intervals)
+
+# Perform the calculations
+result_obj_exclude1 <- pk.nca(data_obj_exclude1)
+
## No dose information provided, calculations requiring dose will return NA.
+
# Results differ when excluding the 12-hour point for subject 1 (compare to
+# example in the previous section)
+as.data.frame(result_obj_exclude1)
+
## # A tibble: 10 x 6
+##    Subject start   end PPTESTCD            PPORRES exclude
+##    <ord>   <dbl> <dbl> <chr>                 <dbl> <chr>  
+##  1 1           0   Inf tmax                 1.12   <NA>   
+##  2 1           0   Inf tlast               24.4    <NA>   
+##  3 1           0   Inf lambda.z             0.0482 <NA>   
+##  4 1           0   Inf r.squared            1.00   <NA>   
+##  5 1           0   Inf adj.r.squared        0.999  <NA>   
+##  6 1           0   Inf lambda.z.time.first  5.1    <NA>   
+##  7 1           0   Inf lambda.z.n.points    4      <NA>   
+##  8 1           0   Inf clast.pred           3.28   <NA>   
+##  9 1           0   Inf half.life           14.4    <NA>   
+## 10 1           0   Inf span.ratio           1.34   <NA>
+
+
+

Specification of the Exact Points for Analysis

+

In other cases, the exact points to use for half-life calculation are known, and automatic point selection with curve stripping should not be performed.

+

To exclude specific points but otherwise use curve stripping, use the include_half.life option as the column name in the concentration dataset for PKNCAconc() as illustrated below.

+
data_conc$include_hl <- data_conc$Time > 3
+# Confirm that we will be excluding exactly one point
+stopifnot(sum(data_conc$include_hl) == 6)
+
+# Drop one point
+conc_obj_include6 <-
+  PKNCAconc(
+    data_conc,
+    conc~Time|Subject,
+    include_half.life="include_hl"
+  )
+
+data_obj_include6 <- PKNCAdata(conc_obj_include6, intervals=current_intervals)
+
+# Perform the calculations
+result_obj_include6 <- pk.nca(data_obj_include6)
+
## No dose information provided, calculations requiring dose will return NA.
+
# Results differ when including 6 points (compare to example in the previous
+# section)
+as.data.frame(result_obj_include6)
+
## # A tibble: 10 x 6
+##    Subject start   end PPTESTCD            PPORRES exclude
+##    <ord>   <dbl> <dbl> <chr>                 <dbl> <chr>  
+##  1 1           0   Inf tmax                 1.12   <NA>   
+##  2 1           0   Inf tlast               24.4    <NA>   
+##  3 1           0   Inf lambda.z             0.0475 <NA>   
+##  4 1           0   Inf r.squared            0.999  <NA>   
+##  5 1           0   Inf adj.r.squared        0.998  <NA>   
+##  6 1           0   Inf lambda.z.time.first  3.82   <NA>   
+##  7 1           0   Inf lambda.z.n.points    6      <NA>   
+##  8 1           0   Inf clast.pred           3.30   <NA>   
+##  9 1           0   Inf half.life           14.6    <NA>   
+## 10 1           0   Inf span.ratio           1.41   <NA>
+
+
+ + + + + + + + + + + diff --git a/doc/Introduction-and-Usage.html b/doc/Introduction-and-Usage.html index b3e60c43..6c968c7c 100644 --- a/doc/Introduction-and-Usage.html +++ b/doc/Introduction-and-Usage.html @@ -1,38 +1,54 @@ - + - - + Introduction to PKNCA and Usage Instructions + + - + + + + @@ -311,12 +146,14 @@

Bill Denney

  • Quick Start
  • Data Handling
  • -
  • Options: Make PKNCA Work Your Way
      +
    • Options: Make PKNCA Work Your Way +
    • Grouping NCA Data
    • -
    • Selecting Calculation Intervals
        +
      • Selecting Calculation Intervals +
        • Selection of Data Used for Calculation
        • Automatic Interval Determination
        • Manual Interval Specification
        • @@ -329,51 +166,55 @@

          Bill Denney

          Quick Start

          The simplest analysis requires concentration and dosing data, then five function calls can provide summarized results. (Please note that this and the other examples in this document are intended to show the typical workflow, but they are not intended to run directly. For an example to run directly, please see the theophylline example.)

          -
          library(PKNCA)
          -library(dplyr, quietly=TRUE)
          -
          -## Load the PK concentration data
          -d_conc <- datasets::Theoph %>%
          -  mutate(Subject=as.numeric(as.character(Subject)))
          -## Generate the dosing data
          -d_dose <- d_conc[d_conc$Time == 0,]
          -d_dose$Time <- 0
          -
          -## Create a concentration object specifying the concentration, time, and
          -## subject columns.  (Note that any number of grouping levels is
          -## supported; you are not restricted to just grouping by subject.)
          -conc_obj <- PKNCAconc(d_conc,
          -                      conc~Time|Subject)
          -## Create a dosing object specifying the dose, time, and subject
          -## columns.  (Note that the grouping factors should be the same as or a
          -## subset of the grouping factors for concentration, and the grouping
          -## columns must have the same names between concentration and dose
          -## objects.)
          -dose_obj <- PKNCAdose(d_dose,
          -                      Dose~Time|Subject)
          -## Combine the concentration and dosing information both to
          -## automatically define the intervals for NCA calculation and provide
          -## doses for calculations requiring dose.
          -data_obj <- PKNCAdata(conc_obj, dose_obj)
          -
          -## Calculate the NCA parameters
          -results_obj <- pk.nca(data_obj)
          -
          -## Summarize the results
          -summary(results_obj)
          -
          ##  start end  N     auclast        cmax               tmax   half.life
          -##      0  24 12 74.6 [24.3]           .                  .           .
          -##      0 Inf 12           . 8.65 [17.0] 1.14 [0.630, 3.55] 8.18 [2.12]
          -##  aucinf.obs
          -##           .
          -##  115 [28.4]
          +
          library(PKNCA)
          +library(dplyr, quietly=TRUE)
          +
          +## Load the PK concentration data
          +d_conc <-
          +  as.data.frame(datasets::Theoph) %>%
          +  mutate(Subject=as.numeric(as.character(Subject)))
          +## Generate the dosing data
          +d_dose <- d_conc[d_conc$Time == 0,]
          +d_dose$Time <- 0
          +
          +## Create a concentration object specifying the concentration, time, and
          +## subject columns.  (Note that any number of grouping levels is
          +## supported; you are not restricted to just grouping by subject.)
          +conc_obj <-
          +  PKNCAconc(
          +    d_conc,
          +    conc~Time|Subject
          +  )
          +## Create a dosing object specifying the dose, time, and subject
          +## columns.  (Note that the grouping factors should be the same as or a
          +## subset of the grouping factors for concentration, and the grouping
          +## columns must have the same names between concentration and dose
          +## objects.)
          +dose_obj <-
          +  PKNCAdose(
          +    d_dose,
          +    Dose~Time|Subject
          +  )
          +## Combine the concentration and dosing information both to
          +## automatically define the intervals for NCA calculation and provide
          +## doses for calculations requiring dose.
          +data_obj <- PKNCAdata(conc_obj, dose_obj)
          +
          +## Calculate the NCA parameters
          +results_obj <- pk.nca(data_obj)
          +
          +## Summarize the results
          +summary(results_obj)
          +
          ##  start end  N     auclast        cmax               tmax   half.life aucinf.obs
          +##      0  24 12 74.6 [24.3]           .                  .           .          .
          +##      0 Inf 12           . 8.65 [17.0] 1.14 [0.630, 3.55] 8.18 [2.12] 115 [28.4]
           ## 
           ## Caption: auclast, cmax, aucinf.obs: geometric mean and geometric coefficient of variation; tmax: median and range; half.life: arithmetic mean and standard deviation

          Data Handling

          After loading data, it must be in the right form. The minimum requirements are that concentration, dose, and time must all be numeric (and not factors). Grouping variables have no specific requirements; they can be any mode.

          -

          Values below the limit of quantificaiton are coded as zeros (0), and missing values are coded as NA.

          +

          Values below the limit of quantification are coded as zeros (0), and missing values are coded as NA.

          Options: Make PKNCA Work Your Way

          @@ -381,7 +222,7 @@

          Options: Make PKNCA Work Your Way

          Calculation Options: the PKNCA.options Function

          Different organizations have different requirements for computation and summarization of NCA. Options for how to perform calculations and summaries are handled by the PKNCA.options command.

          Default options have been set to commonly-used standard parameters. The current value for options can be found by running the command with no arguments:

          -
          PKNCA.options()
          +
          PKNCA.options()
          ## $adj.r.squared.factor
           ## [1] 1e-04
           ## 
          @@ -391,6 +232,9 @@ 

          Calculation Options: the PKNCA.options Function

          ## $auc.method ## [1] "lin up/log down" ## +## $conc_above +## [1] NA +## ## $conc.na ## [1] "drop" ## @@ -430,133 +274,133 @@

          Calculation Options: the PKNCA.options Function

          ## start end auclast aucall aumclast aumcall aucint.last aucint.last.dose ## 1 0 24 TRUE FALSE FALSE FALSE FALSE FALSE ## 2 0 Inf FALSE FALSE FALSE FALSE FALSE FALSE -## aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn -## 1 FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE -## cmax cmin tmax tlast tfirst clast.obs cl.last cl.all f mrt.last -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## mrt.iv.last vss.last vss.iv.last cav ctrough ptr tlag deg.fluc -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## swing ceoi ae clr.last clr.obs clr.pred fe half.life r.squared -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE -## adj.r.squared lambda.z lambda.z.time.first lambda.z.n.points clast.pred -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## span.ratio cmax.dn cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## thalf.eff.last thalf.eff.iv.last kel.last kel.iv.last aucinf.obs -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE TRUE -## aucinf.pred aumcinf.obs aumcinf.pred aucint.inf.obs aucint.inf.obs.dose -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## aucint.inf.pred aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn -## 1 FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE -## aumcinf.obs.dn aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred -## 1 FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE -## mrt.obs mrt.pred mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## vz.pred vss.obs vss.pred vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred -## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE -## vd.obs vd.pred thalf.eff.obs thalf.eff.pred thalf.eff.iv.obs -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE -## thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs kel.iv.pred -## 1 FALSE FALSE FALSE FALSE FALSE -## 2 FALSE FALSE FALSE FALSE FALSE
          +## aucint.all aucint.all.dose auclast.dn aucall.dn aumclast.dn aumcall.dn cmax +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE TRUE +## cmin tmax tlast tfirst clast.obs cl.last cl.all f mrt.last mrt.iv.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.last vss.iv.last cav ctrough ptr tlag deg.fluc swing ceoi ae +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## clr.last clr.obs clr.pred fe time_above half.life r.squared adj.r.squared +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE +## lambda.z lambda.z.time.first lambda.z.n.points clast.pred span.ratio cmax.dn +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## cmin.dn clast.obs.dn clast.pred.dn cav.dn ctrough.dn thalf.eff.last +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.iv.last kel.last kel.iv.last aucinf.obs aucinf.pred aumcinf.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE TRUE FALSE FALSE +## aumcinf.pred aucint.inf.obs aucint.inf.obs.dose aucint.inf.pred +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aucint.inf.pred.dose aucinf.obs.dn aucinf.pred.dn aumcinf.obs.dn +## 1 FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE +## aumcinf.pred.dn aucpext.obs aucpext.pred cl.obs cl.pred mrt.obs mrt.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## mrt.iv.obs mrt.iv.pred mrt.md.obs mrt.md.pred vz.obs vz.pred vss.obs vss.pred +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## vss.iv.obs vss.iv.pred vss.md.obs vss.md.pred vd.obs vd.pred thalf.eff.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE FALSE +## thalf.eff.pred thalf.eff.iv.obs thalf.eff.iv.pred kel.obs kel.pred kel.iv.obs +## 1 FALSE FALSE FALSE FALSE FALSE FALSE +## 2 FALSE FALSE FALSE FALSE FALSE FALSE +## kel.iv.pred +## 1 FALSE +## 2 FALSE

And, to reset the current values to the library defaults, run the function with the default argument set to TRUE.

-
PKNCA.options(default=TRUE)
+
PKNCA.options(default=TRUE)

Each of the options is documented where it is used; for example, the first.tmax option is documented in the pk.calc.tmax function.

Summarization Options: the PKNCA.set.summary Function

On top of methods of calculation, summarization method preferences differ. Typical summarization preferences include selection of the measurement of central tendency and dispersion, handling of missing values, handling of values below the limit of quantification, and more. Beyond the method for summarization, presentation is managed through user preferences. Presentation is typically controlled by rounding to either a defined number of decimal places or significant figures.

An example is that Cmax may be summarized by the geometric mean with the geometric CV using three significant figures, and having a summary result requires that at least half of the available values are present (not missing). The code below will set this example.

-
PKNCA.set.summary(name="cmax",
-                  point=business.geomean,
-                  spread=business.geocv,
-                  rounding=list(signif=3))
+
PKNCA.set.summary(name="cmax",
+                  point=business.geomean,
+                  spread=business.geocv,
+                  rounding=list(signif=3))

Another example is that Tmax is usually summarized by the median and range, and as measurements are often taken with minute resolution and recorded in hours, reporting is usually to the second decimal place.

-
PKNCA.set.summary(name="tmax",
-                  point=business.median,
-                  spread=business.range,
-                  rounding=list(round=2))
+
PKNCA.set.summary(name="tmax",
+                  point=business.median,
+                  spread=business.range,
+                  rounding=list(round=2))

If the functions or default rounding options provided in the library do not meet the summarization needs, a user-supplied function can be used for rounding.

-
median_na <- function(x) {
-  median(x, na.rm=TRUE)
-}
-quantprob_na <- function(x) {
-  quantile(x, probs=c(0.05, 0.95), na.rm=TRUE)
-}
-PKNCA.set.summary(name="auclast",
-                  point=median_na,
-                  spread=quantprob_na,
-                  rounding=list(signif=3))
+
median_na <- function(x) {
+  median(x, na.rm=TRUE)
+}
+quantprob_na <- function(x) {
+  quantile(x, probs=c(0.05, 0.95), na.rm=TRUE)
+}
+PKNCA.set.summary(name="auclast",
+                  point=median_na,
+                  spread=quantprob_na,
+                  rounding=list(signif=3))

In some cases multiple parameters may need the same summary functions (as often occurs with simulated data). Many parameters can be set simultaneously by specifying a vector of names.

-
median_na <- function(x) {
-  median(x, na.rm=TRUE)
-}
-quantprob_na <- function(x) {
-  quantile(x, probs=c(0.05, 0.95), na.rm=TRUE)
-}
-PKNCA.set.summary(name=c("auclast", "cmax", "tmax", "half.life", "aucinf.pred"),
-                  point=median_na,
-                  spread=quantprob_na,
-                  rounding=list(signif=3))
+
median_na <- function(x) {
+  median(x, na.rm=TRUE)
+}
+quantprob_na <- function(x) {
+  quantile(x, probs=c(0.05, 0.95), na.rm=TRUE)
+}
+PKNCA.set.summary(name=c("auclast", "cmax", "tmax", "half.life", "aucinf.pred"),
+                  point=median_na,
+                  spread=quantprob_na,
+                  rounding=list(signif=3))

Grouping NCA Data

As described in the quick start, concentration and dose data are generally grouped to identify how to separate the data. Typical groups for concentration data include study, treatment, subject, and analyte. Typical groups for dose data include study, treatment, and subject. By default, summaries are produced based on the concentration groups dropping the subject (so that averages are taken across subjects within the other parameters).

The quick start example can be extended to include multiple analytes as follows. The only difference is the /analyte formula element in the concentration data. The reason for the slash instead of the plus is that the last element before a slash is assumed to be the subject, and as noted before, the subject is (by default) excluded from the summary grouping (so that summaries are grouped by study, treatment, etc., but not by subject).

-
## Generate a faux multi-study, multi-analyte dataset.
-d_conc_parent <- d_conc
-d_conc_parent$Subject <- as.numeric(as.character(d_conc_parent$Subject))
-d_conc_parent$Study <- d_conc_parent$Subject <= 6
-d_conc_parent$Analyte <- "Parent"
-d_conc_metabolite <- d_conc_parent
-d_conc_metabolite$conc <- d_conc_metabolite$conc/2
-d_conc_metabolite$Analyte <- "Metabolite"
-d_conc_both <- rbind(d_conc_parent, d_conc_metabolite)
-d_conc_both <- d_conc_both[with(d_conc_both, order(Study, Subject, Time, Analyte)),]
-d_dose_both <- d_conc_both[d_conc_both$Time == 0 & d_conc_both$Analyte %in% "Parent",
-                           c("Study", "Subject", "Dose", "Time")]
-
-## Create a concentration object specifying the concentration, time,
-## study, and subject columns.  (Note that any number of grouping
-## levels is supporting; you are not restricted to this list.)
-conc_obj <- PKNCAconc(d_conc_both,
-                      conc~Time|Study+Subject/Analyte)
-## Create a dosing object specifying the dose, time, study, and
-## subject columns.  (Note that the grouping factors should be a
-## subset of the grouping factors for concentration, and the columns
-## must have the same names between concentration and dose objects.)
-dose_obj <- PKNCAdose(d_dose_both,
-                     Dose~Time|Study+Subject)
-
-# Perform and summarize the PK data as previously described
-data_obj <- PKNCAdata(conc_obj, dose_obj)
-results_obj <- pk.nca(data_obj)
-summary(results_obj)
+
## Generate a faux multi-study, multi-analyte dataset.
+d_conc_parent <- d_conc
+d_conc_parent$Subject <- as.numeric(as.character(d_conc_parent$Subject))
+d_conc_parent$Study <- d_conc_parent$Subject <= 6
+d_conc_parent$Analyte <- "Parent"
+d_conc_metabolite <- d_conc_parent
+d_conc_metabolite$conc <- d_conc_metabolite$conc/2
+d_conc_metabolite$Analyte <- "Metabolite"
+d_conc_both <- rbind(d_conc_parent, d_conc_metabolite)
+d_conc_both <- d_conc_both[with(d_conc_both, order(Study, Subject, Time, Analyte)),]
+d_dose_both <- d_conc_both[d_conc_both$Time == 0 & d_conc_both$Analyte %in% "Parent",
+                           c("Study", "Subject", "Dose", "Time")]
+
+## Create a concentration object specifying the concentration, time,
+## study, and subject columns.  (Note that any number of grouping
+## levels is supporting; you are not restricted to this list.)
+conc_obj <- PKNCAconc(d_conc_both,
+                      conc~Time|Study+Subject/Analyte)
+## Create a dosing object specifying the dose, time, study, and
+## subject columns.  (Note that the grouping factors should be a
+## subset of the grouping factors for concentration, and the columns
+## must have the same names between concentration and dose objects.)
+dose_obj <- PKNCAdose(d_dose_both,
+                     Dose~Time|Study+Subject)
+
+# Perform and summarize the PK data as previously described
+data_obj <- PKNCAdata(conc_obj, dose_obj)
+results_obj <- pk.nca(data_obj)
+summary(results_obj)

Selecting Calculation Intervals

-

All NCA calculations require the inverval over which they are calculated. When the concentration and dosing information are combined to the PKNCAdata object, intervals are automatically determined. The exception to this automatic determination is if the user provides intervals.

+

All NCA calculations require the interval over which they are calculated. When the concentration and dosing information are combined to the PKNCAdata object, intervals are automatically determined. The exception to this automatic determination is if the user provides intervals.

When selected either automatically or manually, intervals define at minimum a start time, an end time, and the parameters to be calculated. The parameter list is available from the get.interval.cols function. The parameters requested are specified by setting the entry in a data.frame as requested.

-
intervals <-
-  data.frame(start=0, end=c(24, Inf),
-             cmax=c(FALSE, TRUE),
-             tmax=c(FALSE, TRUE),
-             auclast=TRUE,
-             aucinf.obs=c(FALSE, TRUE))
+
intervals <-
+  data.frame(start=0, end=c(24, Inf),
+             cmax=c(FALSE, TRUE),
+             tmax=c(FALSE, TRUE),
+             auclast=TRUE,
+             aucinf.obs=c(FALSE, TRUE))

Intervals like the above is sufficient for designs with a single type of treatment– like single doses. For more complex treatments in a single analysis, like the combination of single and multiple doses, include a treatment column matching the treatment column name from the concentration data set. See the Manual Interval Specification section below for more details.

Selection of Data Used for Calculation

@@ -567,7 +411,107 @@

Selection of Data Used for Calculation

Automatic Interval Determination

If intervals are not specified when combining the concentration and dosing data, they will automatically be found from the concentration and dosing data.

Single dose data has a simple interval selection: the option single.dose.aucs is used from the PKNCA.options.

-
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -609,6 +553,7 @@

Automatic Interval Determination

+ @@ -768,6 +713,7 @@

Automatic Interval Determination

+ @@ -809,6 +755,7 @@

Automatic Interval Determination

+ @@ -870,19 +817,19 @@

Automatic Interval Determination

startclr.obs clr.pred fetime_above half.life r.squared adj.r.squaredFALSE FALSE FALSEFALSE
0FALSE FALSE FALSEFALSE TRUE FALSE FALSE
-

For multiple-dose studies, PKNCA selects one group at a time and compares the concentration and dosing times. When there is a concentation measurement between doses, an interval row is added. The dosing interval (\(\tau\)) is determined by looking for pattern repeats within the dosing data using the find.tau function.

-
## find.tau can work when all doses have the same interval...
-dose_times <- seq(0, 168, by=24)
-print(dose_times)
+

For multiple-dose studies, PKNCA selects one group at a time and compares the concentration and dosing times. When there is a concentration measurement between doses, an interval row is added. The dosing interval (\(\tau\)) is determined by looking for pattern repeats within the dosing data using the find.tau function.

+
## find.tau can work when all doses have the same interval...
+dose_times <- seq(0, 168, by=24)
+print(dose_times)
## [1]   0  24  48  72  96 120 144 168
-
PKNCA::find.tau(dose_times)
+
PKNCA::find.tau(dose_times)
## [1] 24
-
## or when the doses have mixed intervals (10 and 24 hours).
-dose_times <- sort(c(seq(0, 168, by=24),
-                     seq(10, 178, by=24)))
-print(dose_times)
+
## or when the doses have mixed intervals (10 and 24 hours).
+dose_times <- sort(c(seq(0, 168, by=24),
+                     seq(10, 178, by=24)))
+print(dose_times)
##  [1]   0  10  24  34  48  58  72  82  96 106 120 130 144 154 168 178
-
PKNCA::find.tau(dose_times)
+
PKNCA::find.tau(dose_times)
## [1] 24

After finding \(\tau\), PKNCA will also look after the last dose (or the beginning of the last dosing interval), and two additional intervals may be added:

    @@ -895,19 +842,19 @@

    Automatic Interval Determination

    Manual Interval Specification

    Intervals can also be specified manually. Two use cases are common for manual specification: fully manual (never requesting the automatic intervals) and updating the automatic intervals.

    Fully manual intervals can be specified by providing it to the PKNCAdata call.

    -
    intervals_manual <-
    -  data.frame(start=0, end=c(24, Inf),
    -             cmax=c(FALSE, TRUE),
    -             tmax=c(FALSE, TRUE),
    -             auclast=TRUE,
    -             aucinf.obs=c(FALSE, TRUE))
    -data_obj <- PKNCAdata(conc_obj, dose_obj, 
    -                      intervals=intervals_manual)
    +
    intervals_manual <-
    +  data.frame(start=0, end=c(24, Inf),
    +             cmax=c(FALSE, TRUE),
    +             tmax=c(FALSE, TRUE),
    +             auclast=TRUE,
    +             aucinf.obs=c(FALSE, TRUE))
    +data_obj <- PKNCAdata(conc_obj, dose_obj, 
    +                      intervals=intervals_manual)

    To update the automatically-selected intervals, extract the intervals, modify them, and put them back.

    -
    data_obj <- PKNCAdata(conc_obj, dose_obj)
    -intervals_manual <- data_obj$intervals
    -intervals_manual$aucinf.obs[1] <- TRUE
    -data_obj$intervals <- intervals_manual
    +
    data_obj <- PKNCAdata(conc_obj, dose_obj)
    +intervals_manual <- data_obj$intervals
    +intervals_manual$aucinf.obs[1] <- TRUE
    +data_obj$intervals <- intervals_manual
diff --git a/doc/Methods-for-Dose-Aware-Interpolation-and-Extrapolation.html b/doc/Methods-for-Dose-Aware-Interpolation-and-Extrapolation.html index 798a1e75..f1b78fe7 100644 --- a/doc/Methods-for-Dose-Aware-Interpolation-and-Extrapolation.html +++ b/doc/Methods-for-Dose-Aware-Interpolation-and-Extrapolation.html @@ -1,209 +1,37 @@ - + - - + Methods Used for Dose-Aware Concentration Interpolation/Extrapolation + + - + + @@ -222,7 +50,8 @@

Bill Denney

  • Introduction
  • -
  • Methods
      +
    • Methods +
      • Observed concentration
      • Impossible combinations
      • Doses with no concentrations between
      • @@ -1517,6 +1346,12 @@

        Dose before, concentration after without a dose

        Appendix: Complete Methods Table

        ++++++ diff --git a/doc/Options-for-Controlling-PKNCA.html b/doc/Options-for-Controlling-PKNCA.html index b0313d00..d4282f42 100644 --- a/doc/Options-for-Controlling-PKNCA.html +++ b/doc/Options-for-Controlling-PKNCA.html @@ -1,209 +1,37 @@ - + - - +Options for Controlling PKNCA + + - + + + @@ -222,10 +50,12 @@

        Bill Denney

        • Summary
        • -
        • Options
            +
          • Options +
            • adj.r.squared.factor
            • max.missing
            • auc.method
            • +
            • conc_above
            • conc.na
            • conc.blq
            • first.tmax
            • @@ -242,7 +72,7 @@

              Bill Denney

              Summary

              -

              PKNCA has many options that control its function. These options have effects throughout the package. The options are controlled using either the PKNCA.options function or by passing the options argument to any of the functions with that as an argument. All options supported by the current version of PKNCA (0.9.1.9002) are listed below with their descriptions.

              +

              PKNCA has many options that control its function. These options have effects throughout the package. The options are controlled using either the PKNCA.options function or by passing the options argument to any of the functions with that as an argument. All options supported by the current version of PKNCA (0.9.5) are listed below with their descriptions.

              Options

              @@ -261,6 +91,11 @@

              auc.method

              The method used to calculate the AUC and related statistics. Options are ‘lin up/log down’ and ‘linear’.

              The default value is: lin up/log down

              +
              +

              conc_above

              +

              For the time_above parameter, what concentration should the value be above?

              +

              The default value is: NA

              +

              conc.na

              How should missing (‘NA’) concentration values be handled? See help for ‘clean.conc.na’ for how to use this option.

              @@ -311,7 +146,107 @@

              tau.choices

              single.dose.aucs

              When data is single-dose, what intervals should be used?

              -
        Event Before
        +
        ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -353,6 +288,7 @@

        single.dose.aucs

        + @@ -512,6 +448,7 @@

        single.dose.aucs

        + @@ -553,6 +490,7 @@

        single.dose.aucs

        + diff --git a/doc/PKNCA-validation.html b/doc/PKNCA-validation.html index 08fce50d..ec5e297e 100644 --- a/doc/PKNCA-validation.html +++ b/doc/PKNCA-validation.html @@ -1,38 +1,54 @@ - + - - +PKNCA Validation + + - + + + @@ -311,7 +146,8 @@

        Bill Denney

        start clr.obs clr.pred fetime_above half.life r.squared adj.r.squared FALSE FALSE FALSEFALSE
        0 FALSE FALSE FALSEFALSE TRUE FALSE FALSE
        ++++++ @@ -568,6 +411,12 @@

        aucint

        AUC interval checking

        Testing Filename
        ++++++ @@ -601,6 +450,12 @@

        AUC interval checking

        + + + + + +
        Testing Filename 1 0
        test-check.intervals.Rcheck.intervals works with tibble input (fix #141)10
        @@ -697,46 +552,40 @@

        Class generation-PKNCAconc

        test-class-PKNCAconc.R model frame and parameter extractions -12 +14 0 test-class-PKNCAconc.R -split.PKNCAconc -5 -0 - - -test-class-PKNCAconc.R print.PKNCAconc 3 0 - + test-class-PKNCAconc.R summary.PKNCAconc 1 0 - + test-class-PKNCAconc.R PKNCAconc with exclusions 1 0 - + test-class-PKNCAconc.R PKNCAconc with duration 1 0 - + test-class-PKNCAconc.R PKNCAconc with nominal time added 2 0 - + test-class-PKNCAconc.R PKNCAconc with volume added 3 @@ -748,6 +597,12 @@

        Class generation-PKNCAconc

        Class generation-PKNCAdata

        ++++++ @@ -783,23 +638,17 @@

        Class generation-PKNCAdata

        - - - - - - - + - + @@ -835,7 +684,7 @@

        Class generation-PKNCAdose

        - + @@ -874,6 +723,12 @@

        Class generation-PKNCAdose

        Class generation-PKNCAresults

        Testing Filename
        test-class-PKNCAdata.Rsplitting PKNCAdata10
        test-class-PKNCAdata.R no intervals auto-determined (Fix GitHub issue #84) 3 0
        test-class-PKNCAdata.R Ensure that unexpected arguments to PKNCAdata give an error (related to issue #83) 1 0
        test-class-PKNCAdata.R intervals may be a tibble 1
        test-class-PKNCAdose.R PKNCAdose model.frame1315 0
        ++++++ @@ -892,13 +747,13 @@

        Class generation-PKNCAresults

        - + - + @@ -925,6 +780,24 @@

        Class generation-PKNCAresults

        + + + + + + + + + + + + + + + + + +
        Testing Filename
        test-class-PKNCAresults.R PKNCAresults has exclude, when applicable43 0
        test-class-PKNCAresults.R PKNCAresults summary96 0
        1 0
        test-class-PKNCAresults.Rexclude values are maintained in derived parameters during automatic calculation (#112)30
        test-class-PKNCAresults.Rctrough is correctly calculated20
        test-class-PKNCAresults.Rsingle subject, ungrouped data works (#74)20
        @@ -949,7 +822,7 @@

        Missing and BLQ data cleaners

        test-cleaners.R clean.conc.blq -27 +28 0 @@ -958,6 +831,12 @@

        Missing and BLQ data cleaners

        exclude

        ++++++ @@ -985,6 +864,12 @@

        exclude

        + + + + + +
        Testing Filename 3 0
        test-exclude.Rmultiple exclusions for the same row provide all the reasons (fix #113)10
        @@ -1054,6 +939,12 @@

        Check concentration and time inputs

        Rounding to string values

        ++++++ @@ -1105,7 +996,7 @@

        Half-life

        - + @@ -1114,12 +1005,24 @@

        Half-life

        + + + + + +
        Testing Filename
        test-half.life.R pk.calc.half.life1311 0
        5 0
        test-half.life.Rtwo-point half-life succeeds (fix #114)20

        Interpolation and extrapolation of concentration

        ++++++ @@ -1162,27 +1065,6 @@

        Interpolation and extrapolation of concentration

        Testing Filename
        -
        -

        merging lists

        - - - - - - - - - - - - - - - - - -
        Testing FilenameTest DescriptionNumber of TestsNumber of Failed Tests
        test-merge.Rmerge.splitlist80
        -

        Formula parsing

        @@ -1269,7 +1151,13 @@

        Business rule functions

        All NCA calculations

        -
        +
        ++++++ @@ -1318,7 +1206,7 @@

        All NCA calculations

        - + @@ -1336,7 +1224,7 @@

        All NCA calculations

        - + @@ -1441,7 +1329,7 @@

        Simple NCA functions

        - + @@ -1648,6 +1536,12 @@

        PKNCA option setting

        PKNCA summary setting

        Testing Filename
        test-pk.calc.all.R No interval requested (e.g. for placebo)23 0
        test-pk.calc.all.R Missing dose info for some subjects gives a warning, not a difficult-to-interpret error21 0
        test-pk.calc.simple.R adj.r.squared34 0
        ++++++ @@ -1684,6 +1578,51 @@

        PKNCA summary setting

        Testing Filename
        +
        +

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Testing FilenameTest DescriptionNumber of TestsNumber of Failed Tests
        test-prepare_data.Rprepare_*40
        test-prepare_data.Rfull_join for PKNCAconc, PKNCAdose, and PKNCAdata40
        test-prepare_data.Rcheck_reserved_column_names30
        test-prepare_data.Rstandardize_column_names70
        test-prepare_data.Rrestore_group_col_names50
        +

        Provenance

        @@ -1720,13 +1659,13 @@

        Superposition

        - + - + @@ -1738,6 +1677,39 @@

        Superposition

        test-superpostion.R superposition inputs7674 0
        test-superpostion.R superposition math1814 0
        +
        +

        time_above

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Testing FilenameTest DescriptionNumber of TestsNumber of Failed Tests
        test-time.above.Rtime_above expected errors60
        test-time.above.Rtime_above simple scenarios10
        test-time.above.Rtime_above linear60
        +

        Time to steady-state

        @@ -1780,6 +1752,12 @@

        Time to steady-state

        time_calc()

        ++++++ @@ -1819,12 +1797,12 @@

        time_calc()

        Session Information

        -
        Sys.Date()
        -
        ## [1] "2019-09-19"
        -
        sessionInfo()
        -
        ## R version 3.6.1 (2019-07-05)
        +
        Sys.Date()
        +
        ## [1] "2021-10-29"
        +
        sessionInfo()
        +
        ## R version 4.1.0 (2021-05-18)
         ## Platform: x86_64-w64-mingw32/x64 (64-bit)
        -## Running under: Windows 10 x64 (build 18362)
        +## Running under: Windows 10 x64 (build 19043)
         ## 
         ## Matrix products: default
         ## 
        @@ -1839,30 +1817,27 @@ 

        Session Information

        ## [1] stats graphics grDevices utils datasets methods base ## ## other attached packages: -## [1] testthat_2.2.1 ggplot2_3.2.1 knitr_1.24 cowplot_1.0.0 -## [5] dplyr_0.8.3 PKNCA_0.9.1.9002 +## [1] testthat_3.0.4 ggplot2_3.3.5 knitr_1.34 cowplot_1.1.1 dplyr_1.0.7 +## [6] PKNCA_0.9.5 ## ## loaded via a namespace (and not attached): -## [1] tidyselect_0.2.5 xfun_0.9 remotes_2.1.0 -## [4] purrr_0.3.2 lattice_0.20-38 colorspace_1.4-1 -## [7] vctrs_0.2.0 usethis_1.5.1 htmltools_0.3.6 -## [10] yaml_2.2.0 rlang_0.4.0 pkgbuild_1.0.5 -## [13] pillar_1.4.2 glue_1.3.1 withr_2.1.2 -## [16] sessioninfo_1.1.1 lifecycle_0.1.0 stringr_1.4.0 -## [19] munsell_0.5.0 gtable_0.3.0 devtools_2.2.0 -## [22] htmlwidgets_1.3 evaluate_0.14 memoise_1.1.0 -## [25] labeling_0.3 callr_3.3.1 ps_1.3.0 -## [28] parallel_3.6.1 highr_0.8 Rcpp_1.0.2 -## [31] backports_1.1.4 scales_1.0.0 DT_0.8 -## [34] desc_1.2.0 pkgload_1.0.2 fs_1.3.1 -## [37] digest_0.6.20 stringi_1.4.3 processx_3.4.1 -## [40] grid_3.6.1 rprojroot_1.3-2 cli_1.1.0 -## [43] tools_3.6.1 magrittr_1.5 lazyeval_0.2.2 -## [46] tibble_2.1.3 crayon_1.3.4 tidyr_1.0.0 -## [49] pkgconfig_2.0.2 zeallot_0.1.0 MASS_7.3-51.4 -## [52] ellipsis_0.2.0.1 prettyunits_1.0.2 assertthat_0.2.1 -## [55] rmarkdown_1.15 rstudioapi_0.10 R6_2.4.0 -## [58] nlme_3.1-140 compiler_3.6.1
        +## [1] lattice_0.20-44 tidyr_1.1.3 prettyunits_1.1.1 ps_1.6.0 +## [5] assertthat_0.2.1 rprojroot_2.0.2 digest_0.6.27 utf8_1.2.2 +## [9] R6_2.5.1 evaluate_0.14 highr_0.9 pillar_1.6.2 +## [13] rlang_0.4.11 rstudioapi_0.13 callr_3.7.0 jquerylib_0.1.4 +## [17] rmarkdown_2.10 desc_1.3.0 labeling_0.4.2 devtools_2.4.2 +## [21] stringr_1.4.0 munsell_0.5.0 compiler_4.1.0 xfun_0.25 +## [25] pkgconfig_2.0.3 pkgbuild_1.2.0 htmltools_0.5.2 tidyselect_1.1.1 +## [29] tibble_3.1.4 fansi_0.5.0 crayon_1.4.1 withr_2.4.2 +## [33] MASS_7.3-54 waldo_0.3.0 grid_4.1.0 nlme_3.1-153 +## [37] jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.0 DBI_1.1.1 +## [41] magrittr_2.0.1 scales_1.1.1 cli_3.0.1 stringi_1.7.4 +## [45] cachem_1.0.6 farver_2.1.0 fs_1.5.0 remotes_2.4.0 +## [49] bslib_0.3.0 ellipsis_0.3.2 generics_0.1.0 vctrs_0.3.8 +## [53] tools_4.1.0 glue_1.4.2 purrr_0.3.4 processx_3.5.2 +## [57] pkgload_1.2.1 parallel_4.1.0 fastmap_1.1.0 yaml_2.2.1 +## [61] colorspace_2.0-2 sessioninfo_1.1.1 memoise_2.0.0 sass_0.4.0 +## [65] usethis_2.0.1
        diff --git a/doc/Post-Processing.html b/doc/Post-Processing.html new file mode 100644 index 00000000..5677af3b --- /dev/null +++ b/doc/Post-Processing.html @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + +Post-Processing + + + + + + + + + + + + + + + + + + + + + + + + + +

        Post-Processing

        +

        Bill Denney

        + + + + +
        +

        Introduction

        +

        Once a calculation is complete, the steps to extract the desired results from the results object are described below.

        +
        +
        +

        Setup

        +

        To extract results, first results must be available. The example below comes from the Introduction and Usage vignette and is reproduced here simply to have results available. See that vignette for more details about running PKNCA.

        +
        library(PKNCA)
        +suppressPackageStartupMessages(library(dplyr))
        +
        +d_conc <-
        +  as.data.frame(datasets::Theoph) %>%
        +  mutate(Subject=as.numeric(as.character(Subject)))
        +## Generate the dosing data
        +d_dose <- d_conc[d_conc$Time == 0,]
        +d_dose$Time <- 0
        +
        +conc_obj <-
        +  PKNCAconc(
        +    d_conc,
        +    conc~Time|Subject
        +  )
        +dose_obj <-
        +  PKNCAdose(
        +    d_dose,
        +    Dose~Time|Subject
        +  )
        +data_obj <- PKNCAdata(conc_obj, dose_obj)
        +results_obj <- pk.nca(data_obj)
        +
        +
        +

        Modifying Results

        +
        +

        Exclusion of Select Results

        +

        In many scenarios, individual results may need to be excluded from summaries. To exclude results, use the exclude() function.

        +
        +

        Exclusion Functions

        +

        Several exclusion functions are built into PKNCA. The built-in functions will exclude all results that either apply to the current value or are dependencies of the current value. For example, \(AUC_\infty\) depends on \(\lambda_z\), and excluding based on span ratio will exclude all parameters that depend on \(\lambda_z\), including \(AUC_\infty\).

        +

        To see the built-in functions, type ?exclude_nca at the R command line and review that help page. To use them, provide the function to the FUN argument of exclude() as illustrated below.

        +
        results_excl_span <- exclude(results_obj, FUN=exclude_nca_span.ratio())
        +
        +# Without any exclusions applied, the 'exclude' column is all NA.
        +as.data.frame(results_obj) %>%
        +  filter(Subject == 1)
        +
        ## # A tibble: 14 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>  
        +##  1       1     0    24 auclast              92.4    <NA>   
        +##  2       1     0   Inf cmax                 10.5    <NA>   
        +##  3       1     0   Inf tmax                  1.12   <NA>   
        +##  4       1     0   Inf tlast                24.4    <NA>   
        +##  5       1     0   Inf clast.obs             3.28   <NA>   
        +##  6       1     0   Inf lambda.z              0.0485 <NA>   
        +##  7       1     0   Inf r.squared             1.00   <NA>   
        +##  8       1     0   Inf adj.r.squared         1.00   <NA>   
        +##  9       1     0   Inf lambda.z.time.first   9.05   <NA>   
        +## 10       1     0   Inf lambda.z.n.points     3      <NA>   
        +## 11       1     0   Inf clast.pred            3.28   <NA>   
        +## 12       1     0   Inf half.life            14.3    <NA>   
        +## 13       1     0   Inf span.ratio            1.07   <NA>   
        +## 14       1     0   Inf aucinf.obs          215.     <NA>
        +
        # With exclusions applied, the 'exclude' column has the reason for exclusion.
        +as.data.frame(results_excl_span) %>%
        +  filter(Subject == 1)
        +
        ## # A tibble: 14 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude       
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>         
        +##  1       1     0    24 auclast              92.4    <NA>          
        +##  2       1     0   Inf cmax                 10.5    <NA>          
        +##  3       1     0   Inf tmax                  1.12   <NA>          
        +##  4       1     0   Inf tlast                24.4    <NA>          
        +##  5       1     0   Inf clast.obs             3.28   <NA>          
        +##  6       1     0   Inf lambda.z              0.0485 Span ratio < 2
        +##  7       1     0   Inf r.squared             1.00   Span ratio < 2
        +##  8       1     0   Inf adj.r.squared         1.00   Span ratio < 2
        +##  9       1     0   Inf lambda.z.time.first   9.05   Span ratio < 2
        +## 10       1     0   Inf lambda.z.n.points     3      Span ratio < 2
        +## 11       1     0   Inf clast.pred            3.28   Span ratio < 2
        +## 12       1     0   Inf half.life            14.3    Span ratio < 2
        +## 13       1     0   Inf span.ratio            1.07   Span ratio < 2
        +## 14       1     0   Inf aucinf.obs          215.     Span ratio < 2
        +

        You may also write your own exclusion function. The exclusion functions built-into PKNCA are a bit more complex than required because they handle options and manage general functionality that may not apply to a user-specific need. To write your own exclusion function, it should follow the description of how to write your own exclusion function as described in the details section of ?exclude.

        +
        +
        +

        Excluding Specific Results

        +

        Excluding specific results has the benefit that full control is provided. But, excluding specific points allows for errors to also enter the analysis because parameters that depend on the excluded parameter will not be excluded.

        +
        mask_exclude_cmax <-
        +  results_obj %>%
        +  as.data.frame() %>%
        +  dplyr::mutate(
        +    mask_exclude=Subject == 1 & PPTESTCD == "cmax"
        +  ) %>%
        +  "[["("mask_exclude")
        +results_excl_specific <-
        +  exclude(
        +    results_obj,
        +    mask=mask_exclude_cmax,
        +    reason="Cmax was actually above the ULOQ"
        +  )
        +
        +# Without any exclusions applied, the 'exclude' column is all NA.
        +results_obj %>%
        +  as.data.frame() %>%
        +  filter(Subject == 1)
        +
        ## # A tibble: 14 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>  
        +##  1       1     0    24 auclast              92.4    <NA>   
        +##  2       1     0   Inf cmax                 10.5    <NA>   
        +##  3       1     0   Inf tmax                  1.12   <NA>   
        +##  4       1     0   Inf tlast                24.4    <NA>   
        +##  5       1     0   Inf clast.obs             3.28   <NA>   
        +##  6       1     0   Inf lambda.z              0.0485 <NA>   
        +##  7       1     0   Inf r.squared             1.00   <NA>   
        +##  8       1     0   Inf adj.r.squared         1.00   <NA>   
        +##  9       1     0   Inf lambda.z.time.first   9.05   <NA>   
        +## 10       1     0   Inf lambda.z.n.points     3      <NA>   
        +## 11       1     0   Inf clast.pred            3.28   <NA>   
        +## 12       1     0   Inf half.life            14.3    <NA>   
        +## 13       1     0   Inf span.ratio            1.07   <NA>   
        +## 14       1     0   Inf aucinf.obs          215.     <NA>
        +
        # With exclusions applied, the 'exclude' column has the reason for exclusion.
        +results_excl_specific %>%
        +  as.data.frame() %>%
        +  filter(Subject == 1)
        +
        ## # A tibble: 14 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude                     
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>                       
        +##  1       1     0    24 auclast              92.4    <NA>                        
        +##  2       1     0   Inf cmax                 10.5    Cmax was actually above the~
        +##  3       1     0   Inf tmax                  1.12   <NA>                        
        +##  4       1     0   Inf tlast                24.4    <NA>                        
        +##  5       1     0   Inf clast.obs             3.28   <NA>                        
        +##  6       1     0   Inf lambda.z              0.0485 <NA>                        
        +##  7       1     0   Inf r.squared             1.00   <NA>                        
        +##  8       1     0   Inf adj.r.squared         1.00   <NA>                        
        +##  9       1     0   Inf lambda.z.time.first   9.05   <NA>                        
        +## 10       1     0   Inf lambda.z.n.points     3      <NA>                        
        +## 11       1     0   Inf clast.pred            3.28   <NA>                        
        +## 12       1     0   Inf half.life            14.3    <NA>                        
        +## 13       1     0   Inf span.ratio            1.07   <NA>                        
        +## 14       1     0   Inf aucinf.obs          215.     <NA>
        +
        +
        +

        Multiple Exclusions

        +

        More than one exclusion can be applied sequentially to results as in the example below.

        +
        mask_exclude_lz <-
        +  results_obj %>%
        +  as.data.frame() %>%
        +  dplyr::mutate(
        +    mask_exclude=Subject == 1 & PPTESTCD == "lambda.z"
        +  ) %>%
        +  "[["("mask_exclude")
        +
        +# Starting from the exclusion example above where short span ratios were
        +# excluded, exclude Cmax for Subject 1, too.
        +results_excl_multi <-
        +  exclude(
        +    results_excl_span,
        +    mask=mask_exclude_cmax,
        +    reason="Cmax was actually above the ULOQ"
        +  )
        +results_excl_multi <-
        +  exclude(
        +    results_excl_multi,
        +    mask=mask_exclude_lz,
        +    reason="Issue with lambda.z fit"
        +  )
        +
        +# With exclusions applied, the 'exclude' column has the reason for exclusion.
        +# More than one reason may appear if more than one exclusion is applied.
        +results_excl_multi %>%
        +  as.data.frame() %>%
        +  filter(Subject == 1)
        +
        ## # A tibble: 14 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude                     
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>                       
        +##  1       1     0    24 auclast              92.4    <NA>                        
        +##  2       1     0   Inf cmax                 10.5    Cmax was actually above the~
        +##  3       1     0   Inf tmax                  1.12   <NA>                        
        +##  4       1     0   Inf tlast                24.4    <NA>                        
        +##  5       1     0   Inf clast.obs             3.28   <NA>                        
        +##  6       1     0   Inf lambda.z              0.0485 Span ratio < 2; Issue with ~
        +##  7       1     0   Inf r.squared             1.00   Span ratio < 2              
        +##  8       1     0   Inf adj.r.squared         1.00   Span ratio < 2              
        +##  9       1     0   Inf lambda.z.time.first   9.05   Span ratio < 2              
        +## 10       1     0   Inf lambda.z.n.points     3      Span ratio < 2              
        +## 11       1     0   Inf clast.pred            3.28   Span ratio < 2              
        +## 12       1     0   Inf half.life            14.3    Span ratio < 2              
        +## 13       1     0   Inf span.ratio            1.07   Span ratio < 2              
        +## 14       1     0   Inf aucinf.obs          215.     Span ratio < 2
        +
        +
        +
        +
        +

        Extracting Results

        +
        +

        Summary Results

        +

        Summary results are obtained using the aptly named summary() function. It will output a summary_PKNCAresults object that is simply a data.frame with an attribute of caption. The summary is generated by evaluating summary statistics on each requested parameter. Which summary statistics are calculated for each parameter are set with PKNCA.set.summary(), and they are described in the caption. When a parameter is not requested for a given interval, it is illustrated with a period (.), by default (customizable with the not.requested.string argument to summary()). When a parameter is required to calculate another parameter, but it is not specifically requested, it will not be shown in the summary.

        +

        The summary will have one column for each grouping variable other than the subject grouping variable; one column each for the start and end time; and one column per parameter calculated.

        +
        summary(results_obj)
        +
        ##  start end  N     auclast        cmax               tmax   half.life aucinf.obs
        +##      0  24 12 74.6 [24.3]           .                  .           .          .
        +##      0 Inf 12           . 8.65 [17.0] 1.14 [0.630, 3.55] 8.18 [2.12] 115 [28.4]
        +## 
        +## Caption: auclast, cmax, aucinf.obs: geometric mean and geometric coefficient of variation; tmax: median and range; half.life: arithmetic mean and standard deviation
        +

        When values are excluded as described above, the excluded values are not included in the summary (note that half.life and aucinf.obs differ).

        +
        summary(results_excl_span)
        +
        ##  start end  N     auclast        cmax               tmax    half.life
        +##      0  24 12 74.6 [24.3]           .                  .            .
        +##      0 Inf 12           . 8.65 [17.0] 1.14 [0.630, 3.55] 7.36 [0.742]
        +##  aucinf.obs
        +##           .
        +##  105 [16.4]
        +## 
        +## Caption: auclast, cmax, aucinf.obs: geometric mean and geometric coefficient of variation; tmax: median and range; half.life: arithmetic mean and standard deviation
        +
        +
        +

        Listing of Results

        +

        A listing of all calculated values is available using as.data.frame().

        +
        as.data.frame(results_obj) %>%
        +  head(20)
        +
        ## # A tibble: 20 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>  
        +##  1       1     0    24 auclast              92.4    <NA>   
        +##  2       1     0   Inf cmax                 10.5    <NA>   
        +##  3       1     0   Inf tmax                  1.12   <NA>   
        +##  4       1     0   Inf tlast                24.4    <NA>   
        +##  5       1     0   Inf clast.obs             3.28   <NA>   
        +##  6       1     0   Inf lambda.z              0.0485 <NA>   
        +##  7       1     0   Inf r.squared             1.00   <NA>   
        +##  8       1     0   Inf adj.r.squared         1.00   <NA>   
        +##  9       1     0   Inf lambda.z.time.first   9.05   <NA>   
        +## 10       1     0   Inf lambda.z.n.points     3      <NA>   
        +## 11       1     0   Inf clast.pred            3.28   <NA>   
        +## 12       1     0   Inf half.life            14.3    <NA>   
        +## 13       1     0   Inf span.ratio            1.07   <NA>   
        +## 14       1     0   Inf aucinf.obs          215.     <NA>   
        +## 15       2     0    24 auclast              67.2    <NA>   
        +## 16       2     0   Inf cmax                  8.33   <NA>   
        +## 17       2     0   Inf tmax                  1.92   <NA>   
        +## 18       2     0   Inf tlast                24.3    <NA>   
        +## 19       2     0   Inf clast.obs             0.9    <NA>   
        +## 20       2     0   Inf lambda.z              0.104  <NA>
        +

        Excluded values remain in the listing.

        +
        as.data.frame(results_excl_span) %>%
        +  head(20)
        +
        ## # A tibble: 20 x 6
        +##    Subject start   end PPTESTCD             PPORRES exclude       
        +##      <dbl> <dbl> <dbl> <chr>                  <dbl> <chr>         
        +##  1       1     0    24 auclast              92.4    <NA>          
        +##  2       1     0   Inf cmax                 10.5    <NA>          
        +##  3       1     0   Inf tmax                  1.12   <NA>          
        +##  4       1     0   Inf tlast                24.4    <NA>          
        +##  5       1     0   Inf clast.obs             3.28   <NA>          
        +##  6       1     0   Inf lambda.z              0.0485 Span ratio < 2
        +##  7       1     0   Inf r.squared             1.00   Span ratio < 2
        +##  8       1     0   Inf adj.r.squared         1.00   Span ratio < 2
        +##  9       1     0   Inf lambda.z.time.first   9.05   Span ratio < 2
        +## 10       1     0   Inf lambda.z.n.points     3      Span ratio < 2
        +## 11       1     0   Inf clast.pred            3.28   Span ratio < 2
        +## 12       1     0   Inf half.life            14.3    Span ratio < 2
        +## 13       1     0   Inf span.ratio            1.07   Span ratio < 2
        +## 14       1     0   Inf aucinf.obs          215.     Span ratio < 2
        +## 15       2     0    24 auclast              67.2    <NA>          
        +## 16       2     0   Inf cmax                  8.33   <NA>          
        +## 17       2     0   Inf tmax                  1.92   <NA>          
        +## 18       2     0   Inf tlast                24.3    <NA>          
        +## 19       2     0   Inf clast.obs             0.9    <NA>          
        +## 20       2     0   Inf lambda.z              0.104  <NA>
        +
        +
        + + + + + + + + + + + diff --git a/doc/Selection-of-Calculation-Intervals.html b/doc/Selection-of-Calculation-Intervals.html index f8efaf28..35a3d245 100644 --- a/doc/Selection-of-Calculation-Intervals.html +++ b/doc/Selection-of-Calculation-Intervals.html @@ -1,38 +1,54 @@ - + - - +Selection of Calculation Intervals + + - + + + @@ -310,10 +145,12 @@

        Bill Denney

        • Introduction
        • -
        • Group Matching
            +
          • Group Matching +
          • -
          • Intervals
              +
            • Intervals +
            • @@ -340,19 +177,19 @@

              Introduction

              ## Study 1 Trt 1 1 4 0.8425422 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 6 0.7771994 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 8 0.7052469 Analyte 1 <NA> NA 0 -
              # Plot the concentration-time data and the interval
              -ggplot(d_conc_multi, aes(x=time, y=conc)) +
              -  geom_ribbon(data=d_conc_multi[d_conc_multi$time >= 144,],
              -              aes(ymax=conc, ymin=0),
              -              fill="skyblue") +
              -  geom_point() + geom_line() +
              -  scale_x_continuous(breaks=seq(0, 168, by=12)) +
              -  scale_y_continuous(limits=c(0, NA)) +
              -  labs(x="Time Since First Dose (hr)",
              -       y="Concentration\n(arbitrary units)")
              +
              # Plot the concentration-time data and the interval
              +ggplot(d_conc_multi, aes(x=time, y=conc)) +
              +  geom_ribbon(data=d_conc_multi[d_conc_multi$time >= 144,],
              +              aes(ymax=conc, ymin=0),
              +              fill="skyblue") +
              +  geom_point() + geom_line() +
              +  scale_x_continuous(breaks=seq(0, 168, by=12)) +
              +  scale_y_continuous(limits=c(0, NA)) +
              +  labs(x="Time Since First Dose (hr)",
              +       y="Concentration\n(arbitrary units)")

              -
              intervals_manual <- data.frame(start=144, end=168, auclast=TRUE)
              -knitr::kable(intervals_manual)
              +
              intervals_manual <- data.frame(start=144, end=168, auclast=TRUE)
              +knitr::kable(intervals_manual)
        Testing Filename
        @@ -369,7 +206,7 @@

        Introduction

        -
        PKNCAdata(d_conc, intervals=intervals_manual)
        +
        PKNCAdata(d_conc, intervals=intervals_manual)
        ## Formula for concentration:
         ##  conc ~ time | treatment + ID
         ## With 1 subjects defined in the 'ID' column.
        @@ -395,15 +232,15 @@ 

        Group Matching

        Selecting the Subjects for an Interval

        The groups for an interval prepare for summarization. Typically the groups will take a structure similar to the preferred summarization structure with groups nested in the logical method for summary. As an example, the group structure may be: study, treatment, day, analyte, and subject. The grouping names for an interval must be the same as or a subset of the grouping names used for the concentration data.

        As the matching occurs with all available columns, the grouping columns names are only required to the level of specificity for the calculations desired. As an example, if you want AUCinf,obs in subjects who received single doses and AUClast on days 1 (0 to 24 hours) and 10 (216 to 240 hours) in subjects who received multiple doses, with treatment defined as “Drug 1 Single” or “Drug 1 Multiple”, the intervals could be defined as below.

        -
        intervals_manual <-
        -  data.frame(
        -    treatment=c("Drug 1 Single", "Drug 1 Multiple", "Drug 1 Multiple"),
        -    start=c(0, 0, 216),
        -    end=c(Inf, 24, 240),
        -    aucinf.obs=c(TRUE, FALSE, FALSE),
        -    auclast=c(FALSE, TRUE, TRUE)
        -  )
        -knitr::kable(intervals_manual)
        +
        intervals_manual <-
        +  data.frame(
        +    treatment=c("Drug 1 Single", "Drug 1 Multiple", "Drug 1 Multiple"),
        +    start=c(0, 0, 216),
        +    end=c(Inf, 24, 240),
        +    aucinf.obs=c(TRUE, FALSE, FALSE),
        +    auclast=c(FALSE, TRUE, TRUE)
        +  )
        +knitr::kable(intervals_manual)
        @@ -460,28 +297,28 @@

        To Infinity

        ## Study 1 Trt 1 1 4 0.8425422 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 6 0.7771994 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 8 0.7052469 Analyte 1 <NA> NA 0 -
        # Use superposition to simulate multiple doses
        -ggplot(d_conc$data[d_conc$data$time <= 48,], aes(x=time, y=conc)) +
        -  geom_ribbon(data=d_conc$data,
        -              aes(ymax=conc, ymin=0),
        -              fill="skyblue") +
        -  geom_point() + geom_line() +
        -  scale_x_continuous(breaks=seq(0, 72, by=12)) +
        -  scale_y_continuous(limits=c(0, NA)) +
        -  labs(x="Time Since First Dose (hr)",
        -       y="Concentration\n(arbitrary units)")
        +
        # Use superposition to simulate multiple doses
        +ggplot(d_conc$data[d_conc$data$time <= 48,], aes(x=time, y=conc)) +
        +  geom_ribbon(data=d_conc$data,
        +              aes(ymax=conc, ymin=0),
        +              fill="skyblue") +
        +  geom_point() + geom_line() +
        +  scale_x_continuous(breaks=seq(0, 72, by=12)) +
        +  scale_y_continuous(limits=c(0, NA)) +
        +  labs(x="Time Since First Dose (hr)",
        +       y="Concentration\n(arbitrary units)")

        -
        intervals_manual <-
        -  data.frame(
        -    start=0,
        -    end=Inf,
        -    auclast=TRUE,
        -    aucinf.obs=TRUE
        -  )
        -print(intervals_manual)
        +
        intervals_manual <-
        +  data.frame(
        +    start=0,
        +    end=Inf,
        +    auclast=TRUE,
        +    aucinf.obs=TRUE
        +  )
        +print(intervals_manual)
        ##   start end auclast aucinf.obs
         ## 1     0 Inf    TRUE       TRUE
        -
        my.data <- PKNCAdata(d_conc, intervals=intervals_manual)
        +
        my.data <- PKNCAdata(d_conc, intervals=intervals_manual)

        Multiple Intervals

        @@ -499,27 +336,27 @@

        Multiple Intervals

        ## Study 1 Trt 1 1 4 0.8425422 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 6 0.7771994 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 8 0.7052469 Analyte 1 <NA> NA 0 -
        # Plot the concentration-time data and the interval
        -ggplot(d_conc_multi, aes(x=time, y=conc)) +
        -  geom_ribbon(data=d_conc_multi[d_conc_multi$time <= 24,],
        -              aes(ymax=conc, ymin=0),
        -              fill="skyblue") +
        -  geom_ribbon(data=d_conc_multi[d_conc_multi$time >= 144,],
        -              aes(ymax=conc, ymin=0),
        -              fill="lightgreen") +
        -  geom_point() + geom_line() +
        -  scale_x_continuous(breaks=seq(0, 168, by=12)) +
        -  scale_y_continuous(limits=c(0, NA)) +
        -  labs(x="Time Since First Dose (hr)",
        -       y="Concentration\n(arbitrary units)")
        +
        # Plot the concentration-time data and the interval
        +ggplot(d_conc_multi, aes(x=time, y=conc)) +
        +  geom_ribbon(data=d_conc_multi[d_conc_multi$time <= 24,],
        +              aes(ymax=conc, ymin=0),
        +              fill="skyblue") +
        +  geom_ribbon(data=d_conc_multi[d_conc_multi$time >= 144,],
        +              aes(ymax=conc, ymin=0),
        +              fill="lightgreen") +
        +  geom_point() + geom_line() +
        +  scale_x_continuous(breaks=seq(0, 168, by=12)) +
        +  scale_y_continuous(limits=c(0, NA)) +
        +  labs(x="Time Since First Dose (hr)",
        +       y="Concentration\n(arbitrary units)")

        -
        intervals_manual <-
        -  data.frame(
        -    start=c(0, 144),
        -    end=c(24, 168),
        -    auclast=TRUE
        -  )
        -knitr::kable(intervals_manual)
        +
        intervals_manual <-
        +  data.frame(
        +    start=c(0, 144),
        +    end=c(24, 168),
        +    auclast=TRUE
        +  )
        +knitr::kable(intervals_manual)
        @@ -541,7 +378,7 @@

        Multiple Intervals

        -
        my.data <- PKNCAdata(d_conc, intervals=intervals_manual)
        +
        my.data <- PKNCAdata(d_conc, intervals=intervals_manual)
@@ -561,30 +398,30 @@

Overlapping Intervals and Different Calculations by Interval

## Study 1 Trt 1 1 4 0.8425422 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 6 0.7771994 Analyte 1 <NA> NA 0 ## Study 1 Trt 1 1 8 0.7052469 Analyte 1 <NA> NA 0
-
# Use superposition to simulate multiple doses
-ggplot(d_conc$data, aes(x=time, y=conc)) +
-  geom_ribbon(data=d_conc$data,
-              aes(ymax=conc, ymin=0),
-              fill="lightgreen",
-              alpha=0.5) +
-  geom_ribbon(data=d_conc$data[d_conc$data$time <= 24,],
-              aes(ymax=conc, ymin=0),
-              fill="skyblue",
-              alpha=0.5) +
-  geom_point() + geom_line() +
-  scale_x_continuous(breaks=seq(0, 168, by=12)) +
-  scale_y_continuous(limits=c(0, NA)) +
-  labs(x="Time Since First Dose (hr)",
-       y="Concentration\n(arbitrary units)")
+
# Use superposition to simulate multiple doses
+ggplot(d_conc$data, aes(x=time, y=conc)) +
+  geom_ribbon(data=d_conc$data,
+              aes(ymax=conc, ymin=0),
+              fill="lightgreen",
+              alpha=0.5) +
+  geom_ribbon(data=d_conc$data[d_conc$data$time <= 24,],
+              aes(ymax=conc, ymin=0),
+              fill="skyblue",
+              alpha=0.5) +
+  geom_point() + geom_line() +
+  scale_x_continuous(breaks=seq(0, 168, by=12)) +
+  scale_y_continuous(limits=c(0, NA)) +
+  labs(x="Time Since First Dose (hr)",
+       y="Concentration\n(arbitrary units)")

-
intervals_manual <-
-  data.frame(
-    start=0,
-    end=c(24, Inf),
-    auclast=TRUE,
-    aucinf.obs=c(FALSE, TRUE)
-  )
-knitr::kable(intervals_manual)
+
intervals_manual <-
+  data.frame(
+    start=0,
+    end=c(24, Inf),
+    auclast=TRUE,
+    aucinf.obs=c(FALSE, TRUE)
+  )
+knitr::kable(intervals_manual)
@@ -609,7 +446,7 @@

Overlapping Intervals and Different Calculations by Interval

-
my.data <- PKNCAdata(d_conc, intervals=intervals_manual)
+
my.data <- PKNCAdata(d_conc, intervals=intervals_manual)

Intervals with Duration

@@ -621,6 +458,11 @@

Intervals with Duration

Parameters Available for Calculation in an Interval

The following parameters are available in an interval. For more information about the parameter, see the documentation for the function.

+++++ @@ -1040,76 +882,81 @@

Parameters Available for Calculation in an Interval

+ + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/doc/Superposition.html b/doc/Superposition.html index 0725b112..356f1950 100644 --- a/doc/Superposition.html +++ b/doc/Superposition.html @@ -1,38 +1,54 @@ - + - - +Superposition of Pharmacokinetic Data + + - + + + + @@ -311,9 +146,11 @@

Bill Denney

Parameter Name pk.calc.thalf.eff
time_aboveTime above a given concentrationpk.calc.time_above
tlag Lag time pk.calc.tlag
tlast Time of the last concentration observed above the limit of quantification pk.calc.tlast
tmax Time of the maximum observed concentration pk.calc.tmax
vd.obs Apparent observed volume of distribution calculated with observed Clast pk.calc.vd
vd.pred Apparent observed volume of distribution calculated with predicted Clast pk.calc.vd
vss.iv.last The steady-state volume of distribution with intravenous infusion calculating through Tlast pk.calc.vss
vss.iv.obs The steady-state volume of distribution with intravenous infusion using observed Clast pk.calc.vss
vss.iv.pred The steady-state volume of distribution with intravenous infusion using predicted Clast pk.calc.vss
vss.last The steady-state volume of distribution calculating through Tlast pk.calc.vss
vss.md.obs The steady-state volume of distribution for nonlinear multiple-dose data using observed Clast pk.calc.vss
vss.md.pred The steady-state volume of distribution for nonlinear multiple-dose data using predicted Clast pk.calc.vss
vss.obs The steady-state volume of distribution using observed Clast pk.calc.vss
vss.pred The steady-state volume of distribution using predicted Clast pk.calc.vss
vz.obs The terminal volume of distribution using observed Clast pk.calc.vz
vz.pred The terminal volume of distribution using predicted Clast pk.calc.vz
@@ -383,18 +220,18 @@

Load the data

The columns that we will be interested in for our analysis are conc, Time, and Subject in the concentration data.

-
## By default it is groupedData; convert it to a data frame for use
-conc_obj <- PKNCAconc(as.data.frame(datasets::Theoph), conc~Time|Subject)
+
## By default it is groupedData; convert it to a data frame for use
+conc_obj <- PKNCAconc(as.data.frame(datasets::Theoph), conc~Time|Subject)

Compute the Superposition from Single-Dose Data to Steady-State

With a simple call, we can have the estimated steady-state concentration for each subject. At minimum, the time between dosing (tau) must be provided.

-
steady_state <- superposition(conc_obj, tau=24)
-
## Error in superposition.numeric(tmp.data[[x]]$data[[conc.col]], tmp.data[[x]]$data[[time.col]], : The first concentration must be 0 (and not NA).  To change this set check.blq=FALSE.
+
steady_state <- superposition(conc_obj, tau=24)
+
## Error in superposition.numeric(conc = nested_data$data_conc[[idx]]$conc, : The first concentration must be 0 (and not NA).  To change this set check.blq=FALSE.

The error noting that the first concentration must be zero is due to the fact that superposition usually occurs with single-dose data. If the first concentration is nonzero, the data are not likely to be single-dose (or a data error should be fixed). Let’s find the offending data.

-
knitr::kable(subset(datasets::Theoph, Time == 0 & conc > 0),
-             caption="Nonzero predose measurements",
-             row.names=FALSE)
+
knitr::kable(subset(datasets::Theoph, Time == 0 & conc > 0),
+             caption="Nonzero predose measurements",
+             row.names=FALSE)
@@ -431,15 +268,15 @@

Compute the Superposition from Single-Dose Data to Steady-State

Nonzero predose measurements

For this example, we will assume that these were errors, correct them to zero, and recalculate.

-
## Correct nonzero concentrations at time 0 to be BLQ.
-theoph_corrected <- datasets::Theoph
-theoph_corrected$conc[theoph_corrected$Time == 0] <- 0
-conc_obj_corrected <- PKNCAconc(theoph_corrected, conc~Time|Subject)
-
-## Calculate the new steady-state concentrations with 24 hour dosing
-steady_state <- superposition(conc_obj_corrected, tau=24)
-knitr::kable(head(steady_state, n=14),
-             caption="Superposition at steady-state")
+
## Correct nonzero concentrations at time 0 to be BLQ.
+theoph_corrected <- as.data.frame(datasets::Theoph)
+theoph_corrected$conc[theoph_corrected$Time == 0] <- 0
+conc_obj_corrected <- PKNCAconc(theoph_corrected, conc~Time|Subject)
+
+## Calculate the new steady-state concentrations with 24 hour dosing
+steady_state <- superposition(conc_obj_corrected, tau=24)
+knitr::kable(head(steady_state, n=14),
+             caption="Superposition at steady-state")
@@ -522,17 +359,17 @@

Compute the Superposition from Single-Dose Data to Steady-State

Superposition at steady-state
-

The output is a data.frame including all the grouping factors as columns, a column for concentration, and a column for time. Time point selection ensures that the beginning and end of the interval are included and that every measured time that contributes to the interval is included. The points at the beginning and end of the interval are very similar; they are within a tolerance of 0.001 as defined by the steady.state.tol argument to superposition.

+

The output is a tbl_df, tbl, data.frame including all the grouping factors as columns, a column for concentration, and a column for time. Time point selection ensures that the beginning and end of the interval are included and that every measured time that contributes to the interval is included. The points at the beginning and end of the interval are very similar; they are within a tolerance of 0.001 as defined by the steady.state.tol argument to superposition.

Nonstandard Superposition Computations

Compute the Superposition from Single-Dose Data to a Specific Dose

If simulation to a specific dose is needed, the number of dosing intervals (n.tau) can be specified.

-
## Calculate the unsteady-state concentrations with 24 hour dosing
-unsteady_state <- superposition(conc_obj_corrected, tau=24, n.tau=2)
-knitr::kable(head(unsteady_state, n=14),
-             caption="Superposition before steady-state")
+
## Calculate the unsteady-state concentrations with 24 hour dosing
+unsteady_state <- superposition(conc_obj_corrected, tau=24, n.tau=2)
+knitr::kable(head(unsteady_state, n=14),
+             caption="Superposition before steady-state")
@@ -619,10 +456,10 @@

Compute the Superposition from Single-Dose Data to a Specific Dose

Compute the Superposition from Single-Dose Data with >1 Dose Per Interval

Some dosing intervals are more complex than once per X hours (or days or weeks or…). To predict more complex dosing with superposition, give the dose times within the interval. The dose.times must all be less than tau (otherwise they are not in the interval).

-
## Calculate the new steady-state concentrations with 24 hour dosing
-complex_interval_steady_state <- superposition(conc_obj_corrected, tau=24, dose.times=c(0, 2, 4))
-knitr::kable(head(complex_interval_steady_state, n=10),
-             caption="Superposition at steady-state with complex dosing")
+
## Calculate the new steady-state concentrations with 24 hour dosing
+complex_interval_steady_state <- superposition(conc_obj_corrected, tau=24, dose.times=c(0, 2, 4))
+knitr::kable(head(complex_interval_steady_state, n=10),
+             caption="Superposition at steady-state with complex dosing")
Superposition before steady-state
@@ -685,22 +522,22 @@

Compute the Superposition from Single-Dose Data with >1 Dose Per Interval

Superposition at steady-state with complex dosing
-
ggplot(complex_interval_steady_state,
-       aes(y=conc, x=time, colour=Subject)) +
-  geom_line()
-

+
ggplot(complex_interval_steady_state,
+       aes(y=conc, x=time, colour=Subject)) +
+  geom_line()
+

With this more complex dosing interval, the number of time points estimated increases. The next section describes the selection of time points.

Show the Curve to Steady-State

To determine the concentration curve to get to steady-state, you can give all the dose times considered required to get to steady-state. To do this, specify tau as the total time to steady-state, specify n.tau as 1 to indicate that only one round of dosing should be administered.

This command does not technically go to steady-state; if the dose.times are not sufficiently long to reach steady-state, it only goes for as many doses as requested.

-
up_to_steady_state <- superposition(conc_obj_corrected,
-                                    tau=4*24,
-                                    n.tau=1,
-                                    dose.times=seq(0, 3*24, by=12))
-
ggplot(up_to_steady_state, aes(x=time, y=conc, colour=Subject)) +
-  geom_line()
-

+
up_to_steady_state <- superposition(conc_obj_corrected,
+                                    tau=4*24,
+                                    n.tau=1,
+                                    dose.times=seq(0, 3*24, by=12))
+
ggplot(up_to_steady_state, aes(x=time, y=conc, colour=Subject)) +
+  geom_line()
+

@@ -714,17 +551,15 @@

Time Point Selection and Addition

  • each time from the additional.times argument.
  • How the number of time points increases can be seen by comparing the time points for subject 1 in the steady-state single dosing and the complex dosing examples above.

    -
    steady_state$time[steady_state$Subject == 1]
    -
    ##  [1]  0.00  0.25  0.37  0.57  1.12  2.02  3.82  5.10  7.03  9.05 12.12
    -## [12] 24.00
    -
    sum(steady_state$Subject == 1)
    +
    steady_state$time[steady_state$Subject == 1]
    +
    ##  [1]  0.00  0.25  0.37  0.57  1.12  2.02  3.82  5.10  7.03  9.05 12.12 24.00
    +
    sum(steady_state$Subject == 1)
    ## [1] 12
    -
    complex_interval_steady_state$time[complex_interval_steady_state$Subject == 1]
    -
    ##  [1]  0.00  0.25  0.37  0.57  1.12  2.00  2.02  2.25  2.37  2.57  3.12
    -## [12]  3.82  4.00  4.02  4.25  4.37  4.57  5.10  5.12  5.82  6.02  7.03
    -## [23]  7.10  7.82  9.03  9.05  9.10 11.03 11.05 12.12 13.05 14.12 16.12
    -## [34] 24.00
    -
    sum(complex_interval_steady_state$Subject == 1)
    +
    complex_interval_steady_state$time[complex_interval_steady_state$Subject == 1]
    +
    ##  [1]  0.00  0.25  0.37  0.57  1.12  2.00  2.02  2.25  2.37  2.57  3.12  3.82
    +## [13]  4.00  4.02  4.25  4.37  4.57  5.10  5.12  5.82  6.02  7.03  7.10  7.82
    +## [25]  9.03  9.05  9.10 11.03 11.05 12.12 13.05 14.12 16.12 24.00
    +
    sum(complex_interval_steady_state$Subject == 1)
    ## [1] 34
    diff --git a/doc/Writing-Parameter-Functions.html b/doc/Writing-Parameter-Functions.html index e2d5fc66..7d6b6217 100644 --- a/doc/Writing-Parameter-Functions.html +++ b/doc/Writing-Parameter-Functions.html @@ -1,209 +1,37 @@ - + - - + Writing PKNCA Parameter Functions + + + - + + @@ -222,7 +50,8 @@

    Bill Denney

    • Writing PKNCA Parameter Functions
    • -
    • Writing the Parameter Function
        +
      • Writing the Parameter Function +
      • @@ -272,7 +101,7 @@

        Tell PKNCA about the Parameter

      • name is the name of the parameter (as a character string).
      • FUN is the function name (as a character string).
      • values are the possible values for the interval column (currently only TRUE and FALSE are supported).
      • -
      • depends is a character vector of columns that must exist before this column can be created. Use this to tell PKNCA about calculation dependencies (parameter X must be calculated to be able to calculate paramter Y).
      • +
      • depends is a character vector of columns that must exist before this column can be created. Use this to tell PKNCA about calculation dependencies (parameter X must be calculated to be able to calculate parameter Y).
      • formalsmap remaps the (formal) function arguments. formalsmap is usually used when the same function may be used for multiple different parameters, for example the function pk.calc.thalf.eff is used to calculate the parameters thalf.eff.obs, thalf.eff.pred, thalf.eff.last, thalf.eff.iv.obs, thalf.eff.iv.pred, and thalf.eff.iv.last with different mean residence time inputs.
      • desc is a text description of the parameter.
      diff --git a/man/group_vars.PKNCAconc.Rd b/man/group_vars.PKNCAconc.Rd index 7c3c73a5..4fa1e533 100644 --- a/man/group_vars.PKNCAconc.Rd +++ b/man/group_vars.PKNCAconc.Rd @@ -5,9 +5,9 @@ \alias{group_vars.PKNCAdose} \title{Get grouping variables for a PKNCA object} \usage{ -\method{group_vars}{PKNCAconc}(x) +group_vars.PKNCAconc(x) -\method{group_vars}{PKNCAdose}(x) +group_vars.PKNCAdose(x) } \arguments{ \item{x}{The PKNCA object} diff --git a/vignettes/Post-Processing.Rmd b/vignettes/Post-Processing.Rmd index 7c7477ce..28619792 100644 --- a/vignettes/Post-Processing.Rmd +++ b/vignettes/Post-Processing.Rmd @@ -142,7 +142,7 @@ results_excl_multi %>% ## Summary Results -Summary results are obtained using the aptly named `summary()` function. It will output a `summary_PKNCAresults` object that is simply a data.frame with an attribute of `caption`. The summary is generated by evaluating summary statistics on each requested parameter. Which summary statistics are calculated for each parameter are set with `PKNCA.set.summary()`, and they are described in the caption. When a parameter is not requested for a given interval, it is illustrated with a period (`.`), by default (customizable with the `not.requested.string` argument to `summary()`). When a parameter is required to calculate another parameter, but it is not specifically requeted, it will not be shown in the summary. +Summary results are obtained using the aptly named `summary()` function. It will output a `summary_PKNCAresults` object that is simply a data.frame with an attribute of `caption`. The summary is generated by evaluating summary statistics on each requested parameter. Which summary statistics are calculated for each parameter are set with `PKNCA.set.summary()`, and they are described in the caption. When a parameter is not requested for a given interval, it is illustrated with a period (`.`), by default (customizable with the `not.requested.string` argument to `summary()`). When a parameter is required to calculate another parameter, but it is not specifically requested, it will not be shown in the summary. The summary will have one column for each grouping variable other than the subject grouping variable; one column each for the start and end time; and one column per parameter calculated.