Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calculating AUC with 3 data points using SPSS

2,399 views
Skip to first unread message

Sarah Dinces

unread,
Jul 28, 2013, 10:47:27 AM7/28/13
to
Hello,

I am trying to calculate the area under the curve for all of my cases using SPSS. I have 3 data points, one at baseline, one 30 min later, and the last one 60 min later. I have tried to use the syntax below, but got a series of errors instead of actual output. If necessary, I can send a truncated data file with just the variables I want to use to calculate the AUC. Any help would be much appreciated,

Sarah Dinces, MS
University of New Mexico
Doctoral Candidate in Psychology

LOOP CAMP 1151 to 7307.
DO REPEAT v= PLCORTBL,PLCORT30,PLCORT60.
COMPUTE v=UNIFORM(25) .
END REPEAT.
END CASE.
END FILE.
END PROGRAM.
EXECUTE.
DO REPEAT h =hBL h30 h60 / t = 0 30 60 .
COMPUTE h = t.
END REPEAT.
EXECUTE.

VECTOR time = hBL to h60.
COMPUTE cmax = MAX(PLCORTBL to PLCORT60).
COMPUTE tmax = $sysmis.
COMPUTE lagtime = $sysmis.
COMPUTE auc = 0.
LOOP #k = 1 to 3.
DO IF (NOT(MISSING(drug(#k)))).
IF (NOT(MISSING(lagdrug)))
auc = auc + (time(#k) - lagtime)*(lagdrug + drug(#k))/2 .
IF (drug(#k) = cmax and missing(tmax)) tmax = time(#k) .
COMPUTE lagtime = time(#k).
END IF.
END LOOP.
EXECUTE.

Rich Ulrich

unread,
Jul 28, 2013, 3:38:26 PM7/28/13
to
On Sun, 28 Jul 2013 07:47:27 -0700 (PDT), Sarah Dinces
<sarah....@gmail.com> wrote:

>Hello,
>
>I am trying to calculate the area under the curve for all of my cases using SPSS. I have 3 data points, one at baseline, one 30 min later, and the last one 60 min later. I have tried to use the syntax below, but got a series of errors instead of actual output. If necessary, I can send a truncated data file with just the variables I want to use to calculate the AUC. Any help would be much appreciated,


Your Subject: line says that you want to calculate AUC with
3 data points.

That would seem to be nothing more than
* for times 1, 2, 3 and drug levels 1, 2, 3 .

COMPUTE auc= (time2 - time1)*(drug2 + drug1)/2
+ (time3 - time2)*(drug3 + drug2)/2 .

* for fixed, 30-minute intervals, that reduces to .
COMPUTE auc= (drug1 + 2*drug2 + drug3) *30/2 .

Errors in your SPSS code include
- No END to the first LOOP.
- No definition for the Vector (or function?) used as drug ( ).
- Computation with a variable "lagdrug" which is never defined.

If you want to know the time and amount for maximum
drug level, the code will be more readable if you compute
them without using loops - assign Drug1 and Time1, and use
DO IF to conditionally change the max value for 2 or 3.

--
Rich Ulrich
0 new messages