[R] How to calculate the area under the curve

Sebastien Bihorel sebastien.bihorel at cognigencorp.com
Thu Oct 22 17:02:07 CEST 2009


Well, you can use the trapezoidal rule to numerically calculate any area under
the curve. I don't know if a specific exists but you could create one. The 
principle is basically to compute the area between two successive points of
your profile with:
AREA=0.5*(Response1 + Response2)/(Time2-Time1)

where time1 and time2 are the time of response1 and response2. You will finally
add all the areas together to obtain the total area between your first and last 
point.

HIH


Hi all, 

I would like to calculate the area under the ROC curve for my predictive
model. I have managed to plot points giving me the ROC curve. However, I do
not know how to get the value of the area under. 
Does anybody know of a function that would give the result I want using an
array of specificity and an array of sensitivity as input?

Thanks, 

Olivier




More information about the R-help mailing list