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