auc_partial: Calculate partial AUC

Description Usage Arguments Details See Also Examples

View source: R/AUC_partial.R

Description

Calculate partial AUC

Usage

1
auc_partial(idv, dv, range = c(0, Inf))

Arguments

idv

independent variable (such as time)

dv

dependent variable (such as concentration)

range

time range for pauc calculation

Details

default range is 0 to tmax is recommended to be used alongside dplyr for ease of calculation if an individual does not have any value within the specified range a warning will be issued and an NA value will be returned. This is important if some individuals dropped out early and do not have all observations other individuals have.

See Also

s_pauc

Examples

1
2
3
4
5
6
7
8
9
library(PKPDmisc)
library(dplyr, quiet = TRUE)
df <- capitalize_names(sd_oral_richpk) 
head(df)
df %>% group_by(ID) %>% 
summarize(pAUC0_10 = auc_partial(TIME, CONC, c(0,10)))

df %>% group_by(ID) %>% 
summarize(auc0_tlast = auc_partial(TIME, CONC)) 

Example output

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

  ID TIME  AMT      CONC      AGE   WEIGHT GENDER     RACE DOSE
1  1 0.00 5000  0.000000 56.09591 94.19649   Male Hispanic 5000
2  1 0.25    0  8.612809 56.09591 94.19649   Male Hispanic 5000
3  1 0.50    0 19.436818 56.09591 94.19649   Male Hispanic 5000
4  1 1.00    0 34.006699 56.09591 94.19649   Male Hispanic 5000
5  1 2.00    0 30.228800 56.09591 94.19649   Male Hispanic 5000
6  1 3.00    0 31.299610 56.09591 94.19649   Male Hispanic 5000
# A tibble: 50 x 2
      ID pAUC0_10
   <int>    <dbl>
 1     1 204.2096
 2     2 523.2355
 3     3 315.8860
 4     4 564.1666
 5     5 301.9122
 6     6 154.0215
 7     7 393.2182
 8     8 254.8853
 9     9 286.1393
10    10 121.8113
# ... with 40 more rows
# A tibble: 50 x 2
      ID auc0_tlast
   <int>      <dbl>
 1     1   385.5759
 2     2  1203.4948
 3     3   466.3116
 4     4  1219.6364
 5     5   487.5681
 6     6   295.2480
 7     7   739.0319
 8     8   453.7721
 9     9   698.9862
10    10   161.4484
# ... with 40 more rows

PKPDmisc documentation built on Dec. 18, 2017, 1:05 a.m.