Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Area under a curve

From   "Airey, David C" <>
To   "" <>
Subject   Re: st: Area under a curve
Date   Fri, 20 May 2011 10:29:03 -0500


> Try -pkexamine- or a related command.  I found this with "help area under curve".
> -Steve
> On May 20, 2011, at 9:57 AM, joshua liwindi wrote:
> Hi all
> i have these data set that has a three treatment arm trial on antimalarials, comparing sulphadoxin pyrimethamine(SP) which was the placebo arm VERSUS artesunte one day (AS1) + SP AND artesunate for 3 days + interested in looking at the effect of the drugs on gametocytamia during follow up period i.e day 0.1,2,3,7,14,21,and 28.i want to calculate the AREA UNDER THE CURVE (AUC) as a summary statistic for each of the treatment arms 
> Any help please

If accurate enough for your needs, you can implement the trapezoid rule for AUCs in a fews lines:

// subtract baseline from all subjects
bysort rat_id (day): gen r_minusbase = rotation[_n] - rotation[1]
// make baseline 0 if negative
replace r_minusbase = 0 if r_minusbase < 0
// calculate AUC
sort rat_id day
generate area=(r_minusbase+r_minusbase[_n+1])*(day[_n+1]-day)/2 if rat_id==rat_id[_n+1]

I got this last line from a similar line of Bill Dupont's.
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index