AUCR.test: The area under the curve as pseudo-regression analysis. STILL...

Description Usage Arguments Details Value Author(s) Examples

View source: R/AUCR.test_function.R

Description

The AUCR.test function determines the AUC along an environmental gradient. Otherwise, The value of the AUCG.test returns the probability that a random sample along the gradient ranks higher than the previous.

Usage

1
AUCR.test(x, y, conf.level = 0.95)

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.

Details

AUCi:n(i+1)=AUC(yi:n, y1:i) AUCi:n(i+1) = The AUC for every sample position along the environmental gradient; y1:i = represents the values of y as a function of the first sample 1 till the i-th value; and yi:n = represents the values of i-th(+1) till the last sample (n).

If the AUC.test AUC.test could be captured in the structure AUC(x, y) whereby x is the predictor variable and y the explanatory variable (environmental gradient), then it would be possible the apply the AUC as function of the environment gradient. Let’s assume x = 1,2,3,4,5 and y = 1,2,3,4,5 then yi:n and for the first iteration would be yi:n = 2,3,4,5 and y1:i = 1. For the second iteration yi:n = 3,4,5 and y1:i = 1,2. This is continued along the gradient. For the last (fourth) iteration yi:n = 5 and y1:i = 1,2,3,4. The AUC for every iteration was 1. Therefore, the average probability a second sample taken after the previous has a 100 percent change of being higher.

Value

AUC.stat.estimate

The AUC, which is the probability that a second random sample at a higher position along the gradient x scores/ranks higher than the previous.

Low.conf.prob

The lower confidence interval for the AUC.

High.conf.prob

The higher confidence interval for the AUC.

x.obs

Number of x observations.

y.obs

Number of y observations.

x

Vector used as x.

y

Vector used as y.

AUC.stat.gradient

The AUC along the x gradient.

Author(s)

Willem Kaijser

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
##Create random data
df             <- data.frame(x=1:500, y=(1:500)*rnorm(500,0.1,1)^2)
df$y[df$y < 0] <- abs(df$y[df$y < 0])

##Calculate AUC along gradient
#While R-squared is low the probability that a value ranks higher
#at random locations along the gradient is still ~70 percent
areg <- AUCR.test(df$x, df$y)

##Plot random data
plot(df)
abline(lm(df$y~df$x), col = "red")
text(x = 100, y = 1500,
     labels =paste0("R-squared =", format(summary(lm(df$y~df$x))$r.squared, digits=2)))

##Plot AUC along gradient
plot(areg$x, areg$AUC.stat.gradient, xlab=c("Gradient"), ylab=("AUC"))
## End(Not run)

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