[R] How to calculate the area under the curve
wdunlap at tibco.com
Thu Oct 22 16:59:47 CEST 2009
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of olivier.abz
> Sent: Thursday, October 22, 2009 7:23 AM
> To: r-help at r-project.org
> Subject: [R] How to calculate the area under the curve
> Hi all,
> I would like to calculate the area under the ROC curve for my
> model. I have managed to plot points giving me the ROC curve.
If x and y are the coordinates of the edges of the polygon
(e.g., polygon(x,y) would draw the polygon) then the polygon's
signed area is given by the following
area<-function(x,y)sum(x*c(y[-1],y) - c(x[-1],x)*y)/2
(Positive if edge is traced counter-clockwise.)
This is a discrete version of Green's theorem.
Spotfire, TIBCO Software
> 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?
> View this message in context:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help