AUC.test: The area under the curve (AUC) test

Description Usage Arguments Details Value Author(s) References Examples

View source: R/AUC.test_function.R

Description

The AUC.test function determines the AUC of sample population x in relation to population y. Otherwise, the AUC is the probability that a random sample from population x ranks higher than a random sample from population y.

Usage

1
AUC.test(x, y, conf.level = 0.95, boot = FALSE, nboot = 500)

Arguments

x

A numeric vector with variables of the environmental gradient for population x.

y

A numeric vector with variables of the environmental gradient for population y.

conf.level

An numeric argument that can set the percentile of the confidence interval. Default is 0.95.

boot

An argument that states if the AUC and confidence intervals are determined by bootstrapping. Default is set to FALSE.

nboot

The number of bootstraps used to determine the AUC and confidence intervals. This number needs a minimal of a 100 bootstraps and is by default 500.

Details

The vector x and y should be both numeric. This function uses and relies on the wilcox.test function for acquiring the W statistic to calculate all returned values. The U statistic is calculated according to the first equation below. Whereby U stands for the calculated U statistic, n{x} for the number of observations in population x, n{y} for the number of observation in population x and W for the Wilcox statistic.

U = n{x} ∙ n{y} - W

The U statistic is then used to calculate the AUC.

AUC = \fraq{n{x} ∙ n{y} - U}{n{x} ∙ n{y}}

To acquire the standard error and estimate the confidence intervals the probability values (Q1 and Q2) are calculated according to Hanley and McNeil (1982).

Q{1} = \fraq{AUC}2 - AUC

Q{2} = \fraq{2 ∙ AUC^2}(1 + AUC)

The Standard Error (SE) can then be estimated.

SE = sqrt{\fraq{AUC ∙ (1 - AUC) + (n{x} - 1) ∙ (Q{1} - AUC^2) + (n{y} - 1) ∙ (Q{2} - AUC^2)}n{x} ∙ n{y}}

The Confidence Interval (CI) can than be calculated. Note that here the 95 percent confidence interval is approximated and that this method results in a Gaussian distribution around the AUC. As an artifact of this it is possible to acquire a CI lower than 0 or higher than 1. If this occurs the value is set to either 0 or 1.

CI = SE ∙ 1.96

Additionally, there is also given the possibility to determine the confidence intervals by bootstrapping. This method does not have the limitations resulting a Gaussian distribution around the AUC. For a more in depth explanation of the AUC see Ruscio (2008) and Ruscio and Mullen (2012). However, the distance between the CIs of the bootstrapped method are smaller compared to the method of Hanley and McNeil (1982). This is due to the fact that extreme values in the dataset are less likely to be drawn by bootstrapping.

Value

AUC.stat.estimate

The AUC, which is the probability that a random sample from population x ranks higher than a random sample from population y.

Low.conf.AUC

The lower confidence interval for the AUC.

High.conf.AUC

The higher confidence interval for the AUC.

Author(s)

Willem Kaijser

References

Hanley, J.A., McNeil, B.J., 1982. The meaning and use of the area under a receiver operating characteristic (ROC) curve. Radiology 143, 2936. https://doi.org/10.1148/radiology.143.1.7063747

Ruscio, J., 2008. A probability-based measure of effect size: Robustness to base rates and other factors. Psychol. Methods 13, 19–30. https://doi.org/10.1037/1082-989X.13.1.19

Ruscio, J., Mullen, T., 2012. Confidence Intervals for the Probability of Superiority Effect Size Measure and the Area Under a Receiver Operating Characteristic Curve. Multivar. Behav. Res. 47, 201–223. https://doi.org/10.1080/00273171.2012.658329

Examples

1
2
3
4
## Not run: x <- c(6, 7, 8, 7, 9, 6, 5, 4, 7, 8, 7, 6, 9, 5, 4)
y <- c(4, 3, 5, 3, 6, 2, 2, 1, 6, 7, 4, 3, 2, 4, 3)
AUC.test(x, y)
## End(Not run)

snwikaij/GRASS documentation built on July 29, 2020, 1:54 p.m.