Skip to contents

[Stable]

Calculates AUC from a variety of inputs

Usage

makeAUC(
  data,
  formula,
  include,
  exclude,
  start = 0,
  end = Inf,
  icen = "median",
  outeq = 1,
  block = 1,
  method = "linear",
  addZero = F
)

Arguments

data

A suitable data object, i.e. PM_pop, PM_post, PM_op, PM_sim, or some other suitable dataframe with at least time/observation columns referred to by formula, with an "id" column (so named) if necessary.

formula

A formula of the form obs ~ time. This is only required with data that is not of class PM_pop, PM_post, PM_op or PM_sim.

include

A vector of subject IDs to include in the plot, e.g. c(1:3,5,15)

exclude

A vector of subject IDs to exclude in the plot, e.g. c(4,6:14,16:20)

start

Specify the time to begin AUC calculations. Default is 0.

end

Specify the time to end AUC calculations so that AUC is calculated from start to end. Default for end is the maximum observation time for each subject. Subjects with insufficient data for a specified interval will have AUC calculated for the available data, not to exceed the specified interval.

icen

Can be either "median" for the predictions based on medians ofpred.type parameter value distributions, or "mean". Default is "median". Only relevant for PMpost or PMpop objects.

outeq

Which output equation to plot. Default is 1.

block

Which block to plot, where blocks are defined by dose reset events (EVID = 4) in the data.

method

Default is "linear" for AUC trapezoidal calculation. Any other value will result in linear up, log down.

addZero

Boolean to add a zero concentration at time 0. Default is FALSE.

Value

A dataframe of class PMauc, which has 2 columns:

  • id - Subject identification

  • tau - AUC from start to end

Details

Calculates the area under the time concentration curve using the trapezoidal approximation from a variety of inputs. If a PM_pop, PM_post, PM_op, or PMsim object is specified, formula is not required.

See also

Author

Michael Neely

Examples

library(PmetricsData)
NPex$op$auc()
#> # A tibble: 20 × 2
#> # Groups:   id [20]
#>       id   tau
#>    <dbl> <dbl>
#>  1     1 448. 
#>  2     2 154. 
#>  3     3 147. 
#>  4     4 126. 
#>  5     5  89.9
#>  6     6 312. 
#>  7     7 260. 
#>  8     8 310. 
#>  9     9 208. 
#> 10    10 237. 
#> 11    11 186. 
#> 12    12 234. 
#> 13    13 294. 
#> 14    14 152. 
#> 15    15 224. 
#> 16    16 246. 
#> 17    17 206. 
#> 18    18 288. 
#> 19    19 471. 
#> 20    20 286. 
Indometh %>%
  dplyr::mutate(id = Subject) %>%
  makeAUC(conc ~ time)
#> # A tibble: 6 × 2
#> # Groups:   id [6]
#>   id      tau
#>   <ord> <dbl>
#> 1 1      1.55
#> 2 2      2.68
#> 3 3      2.59
#> 4 4      2.25
#> 5 5      1.70
#> 6 6      2.58