caROC: Covariate-adjusted ROC

Description Usage Arguments Value Author(s) Examples

View source: R/caROC.R

Description

Compute covariate-adjusted specificity at controlled sensitivity level, or covariate-adjusted sensitivity at controlled specificity level, or covariate-adjust receiver operating characteristic curve.

Usage

1
2
3
4
5
caROC(diseaseData, controlData, userFormula, control_sensitivity = NULL,
control_specificity = NULL, mono_resp_method = "ROC",
whichSE = "sample", global_ROC_controlled_by = "sensitivity",
nbootstrap = 100, CI_alpha = 0.95, logit_CI = TRUE,
verbose = TRUE)

Arguments

diseaseData

Data from patients including dependent (biomarker) and independent (covariates) variables.

controlData

Data from controls including dependent (biomarker) and independent (covariates) variables.

userFormula

A character string to represent the function for covariate adjustment. For example, let Y denote biomarker, Z1 and Z2 denote two covariates. Then userFormula = "Y ~ Z1 + Z2".

control_sensitivity

The level(s) of sensitivity to be controlled at. Could be a scalar (e.g. 0.7) or a numeric vector (e.g. c(0.7, 0.8, 0.9)).

control_specificity

The level(s) of specificity to be controlled at. Could be a scalar (e.g. 0.7) or a numeric vector (e.g. c(0.7, 0.8, 0.9)).

mono_resp_method

The method used to restore monotonicity of the ROC curve or computed sensitivity/specificity value. It should one from the following: "none", "ROC". "none" is not applying any monotonicity respecting method. "ROC" is to apply ROC-based monotonicity respecting approach. Default value is "ROC".

whichSE

The method used to compute standard error. It should be one from the following: "sample", "bootstrap", meaning to calculate the standard error using sample-based approach or bootstrap. Default is "sample".

global_ROC_controlled_by

Whether sensitivity/specificity is used to control when computing global ROC. It should one from the following: "sensitivity", "specificity". Default is "sensitivity".

nbootstrap

Number of boostrap iterations. Default is 100.

CI_alpha

Percentage of confidence interval. Default is 0.95.

logit_CI

Whether to apply logit-based confidence interval. Logit-transformed CI has been identified to be more robust near border area.

verbose

Whether to print out messages. Default value is true.

Value

If control_sensitivity or control_specificity is provided, compute covariate-adjusted specificity (sensitivity) at controlled sensitivity (specificity) level.

Estimate

Covariate-adjusted sensitivity/specificity.

SE

Estimated standard error.

CI

Estimated confidence intervals.

If both control_sensitivity and control_specificity are null, compuate covariate-adjusted ROC curve.

sensitivity

Estimated sensitivity.

specificity

Estimated specificity.

mono_adj

Monotonicity adjustment method.

Author(s)

Ziyi.li <ziyi.li@emory.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
n1 = n0 = 500

## generate data
Z_D <- rbinom(n1, size = 1, prob = 0.3)
Z_C <- rbinom(n0, size = 1, prob = 0.7)

Y_C_Z0 <- rnorm(n0, 0.1, 1)
Y_D_Z0 <- rnorm(n1, 1.1, 1)
Y_C_Z1 <- rnorm(n0, 0.2, 1)
Y_D_Z1 <- rnorm(n1, 0.9, 1)

M0 <- Y_C_Z0 * (Z_C == 0) + Y_C_Z1 * (Z_C == 1)
M1 <- Y_D_Z0 * (Z_D == 0) + Y_D_Z1 * (Z_D == 1)

diseaseData <- data.frame(M = M1, Z = Z_D)
controlData <- data.frame(M = M0, Z = Z_C)
userFormula = "M~Z"

## calculate covariate-adjusted specificity at
## controlled sensitivity levels (0.2, 0.8, 0.9)
caROC(diseaseData,controlData,userFormula,
      control_sensitivity = c(0.2,0.8, 0.9),
      control_specificity = NULL,mono_resp_method = "ROC",
      whichSE = "bootstrap",nbootstrap = 100,
      CI_alpha = 0.95, logit_CI = TRUE)

## calculate covariate-adjusted sensitivity at
## controlled specificity levels (0.2, 0.8, 0.9)
caROC(diseaseData,controlData,userFormula,
      control_sensitivity = NULL,
      control_specificity = c(0.7,0.8, 0.9),mono_resp_method = "none",
      whichSE = "sample",nbootstrap = 100,
      CI_alpha = 0.95, logit_CI = TRUE)

## calculate the whole covariate-adjusted ROC curve
ROC1 <- caROC(diseaseData,controlData,userFormula = "M~Z",
                 mono_resp_method = "none")
ROC2 <- caROC(diseaseData,controlData,userFormula = "M~Z",
                 mono_resp_method = "ROC")

ziyili20/caROC documentation built on March 28, 2021, 2:52 a.m.