getAUC: Calculates AUC for a logistic regression.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/getAUC.R

Description

getAUC() takes a series of outcomes, metabolites, and covariates and calculates AUC for each model. You can input as many outcomes and metabolites as you want.

Usage

1
getAUC(dat, outcome, compid, covariates=NULL, normalize=T)

Arguments

dat

Data frame containing your metabolites, outcome, and covariates

outcome

Numeric vector coded [0,1] for your outcome.

compid

Vector of COMP_IDs

covariates

Vector of covariate variable names (optional)

normalize

Normalize the data prior to modeling? (default is TRUE)

Value

If a single outcome is provided, getAUC() will return a data frame with the following variables

COMP_ID

Each COMP_ID listed in compid argument

OUTCOME

Outcome

AUC

AUC calculation

If multiple outcomes are requested, getAUC() will return a list. Each data frame of the list corresponds to each of the outcomes.

Author(s)

Brian Carter and Becky Hodge

See Also

roc, normalizeMets,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# load metabolite data

metabolites <- getMetabolites("breast_metabolomics")
df <- left_join(survey,metabolites$metabolites,"ID")

comp.id <- metabolites$biochem$COMP_ID[1:10]

# code BMI categories as [0,1] - obese vs normal
df$bmi_binary <- ifelse(df$BMI < 25,0, ifelse(df$BMI >= 30,1,NA))

myAUC <- getAUC(df,
                outcome="bmi_binary",
                compid = comp.id,
                covariates="AGE_INT",
                normalize=T)

buddha2490/BERGMets documentation built on Sept. 6, 2020, 5:11 p.m.