auc: auc

Description Usage Arguments Details Value Examples

Description

Calculate the area under the curve for longitudinal data.

Usage

1
2
3
4
5
6
7
auc.args(baseadj = TRUE, missadj = "last.known", onlybase = "NA",
  nobase = "NA", rescale = NULL)

auc(y, t, data, baseadj = FALSE, missadj = c("NA", "zero", "0", "none",
  "last.known", "lowest", "smallest", "highest", "biggest", "first", "baseline",
  "average", "mean"), onlybase = c("NA", "zero", "0"), nobase = c("NA",
  "zero", "0", "none"), rescale = NULL)

Arguments

baseadj

Logical, denoting whether the AUC should be centered at the baseline value (baseadj = TRUE) or not (baseadj = FALSE) (DEFAULT).

missadj

A flag denoting how to deal with missing values at the end of y.

  • 'NA': Set the AUC to NA (DEFAULT)

  • 'zero': Set the AUC to 0. Can also be referred to as '0'

  • 'none': No adjustment; compute what AUC is available

  • 'last.known': Replace missing values with the last known value

  • 'lowest': Replace missing values with the lowest known value. Can also be referred to as 'smallest'

  • 'highest': Replace missing values with the highest known value. Can also be referred to as 'biggest'

  • 'first': Replace missing values with the baseline (first) value. Can also be referred to as 'baseline'

  • 'average': Replace missing values with the average of the known values. Can also be referred to as 'mean'

onlybase

A flag denoting how to deal with cases where there is only one non-missing value. onlybase = 'zero' (or '0') will set the AUC to 0, while onlybase = 'NA' will set it to NA (DEFAULT).

nobase

A flag denoting how to deal with a missing baseline value.

  • 'NA': Set the AUC to NA (DEFAULT)

  • 'zero': Set the AUC to 0. Can also be referred to as '0'

  • 'none': No adjustment; compute what AUC is available (the first known value will be considered as the baseline, but no longer at t[1].)

rescale

(Optional) A number denoting how to scale the AUC; if not missing, the average AUC per time unit will be calculated and multiplied by this value. (DEFAULT NULL means the AUC will not be scaled)

y

A vector of y-values of any length, or else a character string denoting which column in data the y-values should be taken from.

t

A vector of t- (x-) values of the same length as y, or else a character string denoting which column in data the t-values should be taken from. If t is missing, the y-values are assumed to come in regular intervals (i.e. 1:length(y)).

data

An optional data.frame from which y and t come.

Details

auc won't work if you specify the data parameter but also specify vectors for y or t. It also won't work if there are any missing (non-finite) t-values. Any non-finite y-values are ignored.

auc.args creates a list giving the five "adjustment" variables in auc. The defaults are NOT the same as the defaults in auc, however. No error checking is done here! I'm counting on auc to catch all of those.

Value

auc returns the area under the curve.

auc.args returns a list giving the five values. Used mostly as default arguments to other functions.

Examples

1
2
3
4
5
6
7
auc(c(1,0,2,1,1,NA), missadj = 'none')
auc(c(1,0,2,1,1,NA), missadj = 'last.known')
auc(c(1,0,2,1,1,NA), missadj = 'lowest')
auc(c(1,0,2,1,1,NA), missadj = 'highest') # and so on

data <- data.frame(time = c(0,2,3,8), fold.change = c(1, 2, 3, 3))
auc("fold.change", "time", baseadj = TRUE, data = data)

eheinzen/Ethan documentation built on May 3, 2019, 4:32 p.m.