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 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(PKPDmisc) library(dplyr, quiet = TRUE) df <- capitalize_names(sd_oral_richpk) head(df)
#> 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
df %>% group_by(ID) %>% summarize(pAUC0_10 = auc_partial(TIME, CONC, c(0,10)))
#> # A tibble: 50 x 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. #> # ... with 40 more rows
df %>% group_by(ID) %>% summarize(auc0_tlast = auc_partial(TIME, CONC))
#> # A tibble: 50 x 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. #> # ... with 40 more rows