Description Usage Arguments Details Value Author(s) See Also Examples
Compute the area under the curve using linear interpolation for two vectors where one corresponds to the x values and the other corresponds to the y values.
1 |
x |
a numeric vector of x values. |
y |
a numeric vector of y values of the same length as x. |
from |
The value from where to start calculating the area under the curve. Defaults to the smallest x value. |
to |
The value from where to end the calculation of the area under the curve. Defaults to the smallest y value. |
... |
additional arguments passed on to approxfun. In particular rule can be set to determine how values outside the range of x is handled. |
auc is implemented using the approx function together with the composite trapezoid rule. approx creates a function that performs the linear interpolation between points and the trapezoid rule calculates the numerical integral, and by combining these we can handle unsorted time values, missing observations, ties for the time values, and integrating over part of the area or even outside the area.
The value of the area under the curve.
Claus Ekstrom ekstrom@life.ku.dk
1 2 3 4 5 6 7 8 9 10 11 12 |
[1] 4.5
[1] 4.5
[1] 4.5
[1] 4.75
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.