FAQ/AucProg - CBU statistics Wiki
location: FAQ / AucProg

Matthews et al (1990) suggest a method for calculating the area under a curve which is implemented in SPSS below. Time1 to Timek represent the k responses (e.g. over time) and x1 to xk represent the k values at which these were taken e.g. time points. This method works well with peaked data with a common baseline (e.g. 0) measured at unequal intervals.

The example in Appendix II of Matthews et al (1990) is reproduced below. Please note using the method of Matthews et al the area under the curve should read 2190.

```DATA LIST free
/time1 to time11 x1 to x11.
BEGIN DATA.
0 8.3 21.6 33.9 35.5 47.2 38.3 20.5 13.3 0 0 0 5 10 15 20 30 40 60 75 90 120
END DATA.

define !auc( !pos !tokens(1)
/!pos !cmdend).
matrix.
get m /variables=!2.
compute area=make(1,1,0).
loop ib=1 to 1.
+ compute f=0.
+ loop ic= 1 to !1-1.
+ compute id=ic+!1.
+ 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=!2, area.
print area.
end matrix.
!end define.

!auc 11 time1 to time11 x1 to x11.```

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