Diff for "FAQ/rocplot" - CBU statistics Wiki
location: Diff for "FAQ/rocplot"
Differences between revisions 1 and 2
Revision 1 as of 2008-11-24 16:45:40
Size: 888
Editor: PeterWatson
Comment:
Revision 2 as of 2008-11-24 16:49:17
Size: 1413
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
||||<33% style="TEXT-ALIGN: center"> Score || Specificity || 1- Sensitivity ||
||||<33% style="VERTICAL-ALIGN: top; TEXT-ALIGN: center"> 2000 || 0.48 || 0.02 ||
||||<33% style="VERTICAL-ALIGN: top; TEXT-ALIGN: center"> 1000 || 0.56 || 0.035 ||
||||<33% style="VERTICAL-ALIGN: top; TEXT-ALIGN: center"> 400 || 0.59 || 0.06 ||
||||<33% style="VERTICAL-ALIGN: top; TEXT-ALIGN: center"> 200 || 0.74 || 0.16 ||
||||<33% style="VERTICAL-ALIGN: top; TEXT-ALIGN: center"> 100 || 0.85 || 0.30 ||
Line 7: Line 13:
/time1 to time5 x1 to x5. /time1 to time6 x1 to x6.
Line 9: Line 15:
0 0.56 0.78 0.91 1 0 0.01 0.19 0.58 1 0 0.48 0.56 0.59 0.74 0.85 1.00 0 0.02 0.036 0.06 0.10 0.30 1.00

Using SPSS to compute the area under a ROC curve

Score

Specificity

1- Sensitivity

2000

0.48

0.02

1000

0.56

0.035

400

0.59

0.06

200

0.74

0.16

100

0.85

0.30

DATA LIST free
/time1 to time6 x1 to x6. 
BEGIN DATA. 
0 0.48 0.56 0.59 0.74 0.85 1.00 0 0.02 0.036 0.06 0.10 0.30 1.00
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.

None: FAQ/rocplot (last edited 2013-03-08 10:17:30 by localhost)