```Date: Sat, 28 Apr 2001 13:30:24 -0400 Reply-To: dubrowg@dolphin.upenn.edu Sender: "SAS(r) Discussion" From: Greg Dubrow Organization: University of Pennsylvania Subject: Re: problem with area under the curve Content-Type: text/plain; charset=us-ascii Michael Bramley wrote: > > Greg: > > Using the first patient (#22) as an example, are you saying that you're > calculating AUC for length & Critmet (where length=X-axis and Critmet=Y-axis)? > Assuming this is so, the approximate calculation for AUC = sum( abs((X_i - > X_i-1)*Y_i)), (where X_0=0), so that in your case, AUC = (41-0)*3 + (90-41)*2 + > (125*0) for patient #22. > > Note that AUC is a monotonically non-decreasing function, that is, as you add > more time points (X), the AUC function can only increase or stay the same as > area is never negative...perhaps your computation is slipping in a negative > value? > > Since you're using Proc Expand, maybe you should be using the cumulative sum > transformation (CUSUM) ? I tried that, and still get decreasing totals. Inf act, I got the same sums using cusum that I did using sum. The code is this: proc expand data=mtxra20 out=mtxra20z method=spline; convert critmet=total/observed=(beginning,total) transformout=(cusum); id length; **assuming this is the y-axis; by regnum; run; (where regnum=patient number, length=amount of days between visits, critmet=number of criteria met per drug protocol) And here are a set of totals. Again, I'm mystified why some decrease. visit # is not in the computation patient visit length critmet area 757 1 0 0 -1.38 757 5 28 0 24.95 757 13 85 1 101.22 757 22 147 1 56.3 1138 1 0 0 .072 1138 5 28 0 -4.11 1138 13 85 0 63.07 1138 22 147 3 512.05 1157 1 0 0 -7.06 1157 5 28 0 115.3 1157 13 82 5 511.94 1157 22 140 7 599.51 2330 1 0 0 -2.81 2330 5 28 0 48.75 2330 13 84 2 208.53 2330 22 148 2 95.7 Again, any insight would be most appreciated. I'm stumped. greg ```

Back to: Top of message | Previous page | Main SAS-L page