Incremental Area Under the Curve

4 messages
Open this post in threaded view
|

Incremental Area Under the Curve

 Hi, I would like to calculate the incremental area under the curve (for example area above fasting glucose value, excluding negative areas (glucose value is less than fasting glucose value) after study participants eat a standardised meal). I found this syntax for an example data set: * Next sample data come from the above web site. DATA LIST LIST /id meas0 meas15 meas30 meas45 meas60 meas90 meas120 iauc1 (9F8.1). BEGIN DATA 0 4.3 6.3 7.9 5.3 4.1 4.6 4.9 114 1 4 6 6.7 5.5 5.3 5 4.2 155 2 4.1 5.8 8 6.5 5.9 4.8 3.9 179 3 4 5 5.8 5.4 4.8 4.2 4.4 93 4 4.1 6.3 9 8.7 6.7 5.7 3.9 279 5 5 7.1 8.8 8 5.6 5.4 4.2 155 END DATA. LIST. * Set the time constants for the horizontal axis. DO REPEAT h = h0 h15 h30 h45 h60 h90 h120 / t = 0 15 30 45 60 90 120. COMPUTE h = t. END REPEAT. EXECUTE. * trapezoidal integration of glusose = f(time) curve . VECTOR time = h0 to h120. VECTOR gluc = meas0 to meas120 . COMPUTE iauc2 = 0. LOOP #k = 2 to 7. IF #k=2 inival = gluc(1). DO IF (NOT(MISSING(gluc(#k)))). COMPUTE minval=MIN(gluc(#k-1),gluc(#k)) - inival. COMPUTE maxval=MAX(gluc(#k-1),gluc(#k)) - inival. DO IF minval>0. COMPUTE iauc2 = iauc2 + (time(#k) - time(#k -1))*((gluc(#k -1) + gluc(#k))/2-inival) . ELSE IF maxval>0. COMPUTE iauc2 = iauc2 + (time(#k) - time(#k -1))*(maxval / (maxval - minval)*maxval/2) . END IF. END IF. END LOOP. * Clean up. MATCH FILES FILE=* /DROP=h0 h15 h30 h45 h60 h90 h120 minval maxval inival. EXECUTE. I get this output: but it doesn't appear to be calculating anything. Slightly confusingly, the iauc that we would want to calculate in the above example looks like it is actually typed in as part of the syntax rather than calculated. I'd be grateful for any advice on how to get this working and also how to modify the syntax for my own study (11 time points as pasted in below example): t(min) glucose value 0 4.746 15 6.688 30 7.053 45 6.953 60 5.483 90 4.654 120 4.532 180 4.455 240 4.393 300 4.295 BW, Niall 360 4.621 -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Open this post in threaded view
|

Re: Incremental Area Under the Curve

 The syntax could use some more commenting, but it looks good to me. What is listed does NOT show the "LIST" command that lists the original data, which includes iauc1.  What is listed does NOT request that anything more be listed out - which would include iauc2 that has been calculated by the syntax. Maybe the job ran just fine, and just need to do something to look at the results - What does the data editor show for data? As to adapting ... If you don't understand the syntax, you are undertaking something hazardous to correct analyses. Here's an important aspect to understand - VECTOR time = h0 to h120. VECTOR gluc = meas0 to meas120 .    - The lines here, VECTOR, define what is to be used in the loop lower, as indexed variables, time( )   and  gluc( ) .     The time( ) variables are defined in the DO REPEAT as the sampling times.    You need to define your  ho ... h369 ... according to your design.  The gluc( ) variables are the glucose data which were read in as meas0 ... meas120. You need to put your glucose variables into the VECTOR. -- Rich Ulrich From: SPSSX(r) Discussion <[hidden email]> on behalf of njdempster <[hidden email]> Sent: Wednesday, May 30, 2018 4:49:37 PM To: [hidden email] Subject: Incremental Area Under the Curve   Hi, I would like to calculate the incremental area under the curve (for example area above fasting glucose value, excluding negative areas (glucose value is less than fasting glucose value) after study participants eat a standardised meal). I found this syntax for an example data set: * Next sample data come from the above web site. DATA LIST LIST /id meas0 meas15 meas30 meas45 meas60 meas90 meas120 iauc1 (9F8.1). BEGIN DATA 0       4.3 6.3 7.9 5.3 4.1 4.6 4.9 114 1       4 6 6.7 5.5 5.3 5 4.2 155 2       4.1 5.8 8 6.5 5.9 4.8 3.9 179 3       4 5 5.8 5.4 4.8 4.2 4.4 93 4       4.1 6.3 9 8.7 6.7 5.7 3.9 279 5       5 7.1 8.8 8 5.6 5.4 4.2 155 END DATA. LIST. * Set the time constants for the horizontal axis. DO REPEAT h = h0 h15 h30 h45 h60 h90 h120 / t = 0 15 30 45 60 90 120. COMPUTE h = t. END REPEAT. EXECUTE. * trapezoidal integration of glusose = f(time) curve . VECTOR time = h0 to h120. VECTOR gluc = meas0 to meas120 . COMPUTE iauc2 = 0. LOOP #k = 2 to 7. IF #k=2 inival = gluc(1). DO IF (NOT(MISSING(gluc(#k)))). COMPUTE minval=MIN(gluc(#k-1),gluc(#k)) - inival. COMPUTE maxval=MAX(gluc(#k-1),gluc(#k)) - inival. DO IF minval>0. COMPUTE iauc2 = iauc2 + (time(#k) - time(#k -1))*((gluc(#k -1) + gluc(#k))/2-inival) . ELSE IF maxval>0. COMPUTE iauc2 = iauc2 + (time(#k) - time(#k -1))*(maxval / (maxval - minval)*maxval/2) . END IF. END IF. END LOOP. * Clean up. MATCH FILES FILE=* /DROP=h0 h15 h30 h45 h60 h90 h120 minval maxval inival. EXECUTE. I get this output: but it doesn't appear to be calculating anything. Slightly confusingly, the iauc that we would want to calculate in the above example looks like it is actually typed in as part of the syntax rather than calculated. I'd be grateful for any advice on how to get this working and also how to modify the syntax for my own study (11 time points as pasted in below example): t(min) glucose value 0       4.746 15      6.688 30      7.053 45      6.953 60      5.483 90      4.654 120     4.532 180     4.455 240     4.393 300     4.295 BW, Niall 360     4.621 -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD