Calculate partial AUC

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.

It 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

Examples

library(mrgmisc)
library(dplyr, quiet = TRUE)

df <- capitalize_names(sd_oral_richpk) 

df %>% group_by(ID) %>% 
summarize(pAUC0_10 = auc_partial(TIME, CONC, c(0,10)))
#> # A tibble: 50 × 2
#>       ID pAUC0_10
#>    <int>    <dbl>
#>  1     1     204.
#>  2     2     523.
#>  3     3     316.
#>  4     4     564.
#>  5     5     302.
#>  6     6     154.
#>  7     7     393.
#>  8     8     255.
#>  9     9     286.
#> 10    10     122.
#> # ℹ 40 more rows

df %>% group_by(ID) %>% 
summarize(auc0_tlast = auc_partial(TIME, CONC)) 
#> # A tibble: 50 × 2
#>       ID auc0_tlast
#>    <int>      <dbl>
#>  1     1       386.
#>  2     2      1203.
#>  3     3       466.
#>  4     4      1220.
#>  5     5       488.
#>  6     6       295.
#>  7     7       739.
#>  8     8       454.
#>  9     9       699.
#> 10    10       161.
#> # ℹ 40 more rows