approxAUC | R Documentation |
Evaluate the Area Under the Curve (AUC) based on discrete observations y = f(x), using interpolation of order 0 (step), 1 (trapezoidal), or 3 (natural cubic splines). The AUC is the integral of a function over an interval [from,to].
approxAUC(
x,
y,
from,
to,
method = "trapezoid",
subdivisions = 100,
name = "AUC",
na.rm = FALSE
)
x |
[numeric vector] x-values. |
y |
[numeric vector] image of the x-values by the function. |
from |
[numeric] lower border of the intergration domain |
to |
[numeric] upper border of the intergration domain |
method |
[character] the type of interpolation: |
subdivisions |
[integer] number of subdivisions to be used when performing numerical integration of the spline.
Only relevant when |
name |
[character] how to name the output. Can be set to |
na.rm |
[logical] in presence of missing values, should complete.cases of |
This function is a simplified version of the AUC
function from the DescTools package.
a numeric value.
## same examples as DescTools::AUC
approxAUC(x=c(1,3), y=c(1,1), from = 1, to = 3)
approxAUC(x=1:3, y=c(1,2,4), from = 1, to = 3)
approxAUC(x=1:3, y=c(1,2,4), from = 1, to = 3, method = "step")
x <- seq(0, pi, length.out=200)
approxAUC(x=x, y=sin(x), from = 0, to = pi)
approxAUC(x=x, y=sin(x), from = 0, to = pi, method = "spline")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.