Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: calculation of area under curve with stata

 From Jorge Eduardo Pérez Pérez <[email protected]> To "[email protected]" <[email protected]> Subject Re: st: calculation of area under curve with stata Date Wed, 16 Oct 2013 15:02:08 -0400

```I just read Paul Seed's clarification of your question and it seems
that you want an area under a ROC curve, completely unrelated to what
I did. I guess I should have read the clarification before answering.

But in any case, this shows that when you post to Statalist you should
keep in mind that your posts are going to be read by Stata users
outside of your field who do not understand the jargon.

--------------------------------------------
Jorge Eduardo Pérez Pérez
Department of Economics
Brown University

On Wed, Oct 16, 2013 at 2:56 PM, Jorge Eduardo Pérez Pérez
<[email protected]> wrote:
> I am not sure if I am understanding this correctly, but I think you
> want to calculate the area under the curve of a plot of BP measures
> against time for each animal. This could be achieved by calculating
> the area under each trapezoid for each measure and adding them:
>
> clear
> set seed 1234
> set obs 10
> gen time=_n+uniform()
> gen measure=uniform()
> twoway area measure time
> * Area of trapezoid for each time
> gen area=(measure+measure[_n-1])*(time-time[_n-1])*0.5
> egen tarea=total(area)
> sum tarea
>
> Hope this helps,
> --------------------------------------------
> Jorge Eduardo Pérez Pérez
> Department of Economics
> Brown University
>
>
> On Mon, Oct 14, 2013 at 4:38 AM, elmir <[email protected]> wrote:
>> Dear All,
>>
>> I am analyzing the blood pressure (BP) levels from the three different
>> groups of animals. BP was measured repeatedly in every animal at 10
>> different time points within 90 minutes from the start of the experiment.
>> The animals were exposed to 3 different drugs (each group n=8).
>>
>> I understand that one way to compare the effect of the drugs on blood
>> pressure within the whole experimental period would be to calculate the area
>> under the curve and to use this value in a linear mixed model.
>>
>> I would be very grateful if someone could help me with step-by-step
>> instructions how to calculate AUC in stata.
>>
>> Kind regards
>>
>> Elmir Omerovic MD, PhD
>> Sahlgrenska University Hospital
>> Gothenburg, Sweden
>>
>>
>>
>> --
>> View this message in context: http://statalist.1588530.n2.nabble.com/calculation-of-area-under-curve-with-stata-tp7580438.html
>> Sent from the Statalist mailing list archive at Nabble.com.
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```