FAQ/rocplot - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
In thi sntence, what word is mad fro the mising letters?

Revision 1 as of 2008-11-24 16:45:40

location: FAQ / rocplot

Using SPSS to compute the area under a ROC curve

DATA LIST free
/time1 to time5 x1 to x5. 
BEGIN DATA. 
0 0.56 0.78 0.91 1 0 0.01 0.19 0.58 1
END DATA. 

define !trap( !pos !tokens(1)
             /!pos !tokens(1)
             /!pos !cmdend).
matrix.
get m /variables=!3.
compute area=make(!1,1,0).
loop ib=1 to !1.
+ compute f=0.
+ loop ic= 1 to !2-1.
+ compute id=ic+!2.
+ compute g=make(1,1,m(ib,id)).
+ compute h=make(1,1,m(ib,id+1)).
+ compute i=g > h.
+ compute j=i*(g-h)+(1-i)*(h-g).
+ compute a=make(1,1,m(ib,ic)).
+ compute b=make(1,1,m(ib,ic+1)).
+ compute c=a > b.
+ compute d=c*b+(1-c)*a.
+ compute e=0.5*c*(a-b)+0.5*(1-c)*(b-a).
+ compute f=f+((d+e))*j.
+  end loop.
+ compute area(ib)=f.
end loop.
save {m, area} /outfile=* /variables=!3, area.
print area.
end matrix.
!end define.

!trap 1 5 time1 to time5 x1 to x5.