# Re: st: AUC above a fixed value

 From Svend Juul To Subject Re: st: AUC above a fixed value Date Tue, 26 Aug 2008 19:40:13 +0200

```Alvine Bissery wrote:

I need to calculate a AUC of "hem"  with  8 time measurements

time hem
0 116
1 97
2 101
3 114
6 125
12 121
18 118
24 128

But I need only AUC above the threshold of hem=110

Ronan Conroy gave the solution, but:

... my problem is to create the new time variable, because time
values 1 and 2 have changed.

I need a new time variable (time_101)
time_110    hem_101
0       6
x1       0
x2       0
3       4
6       15
12      11
18      8
24      18

Where x1 is between 0 and 1 , and  1<x2<3

=====================================================

It is not clear to me why a new time variable is needed, but:

. generate time_110 = time
. replace time_110 = (time + time[_n+1])/2 if hem<110
. generate hem_110 = (hem-110)*(hem>110)

. list , clean
time   hem   time_110   hem_110
1.      0   116          0         6
2.      1    97        1.5         0
3.      2   101        2.5         0
4.      3   114          3         4
5.      6   125          6        15
6.     12   121         12        11
7.     18   118         18         8
8.     24   128         24        18

Hope this helps
Svend

________________________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C,  Denmark
Phone, work:   +45 8942 6090
Phone, home:   +45 8693 7796
Fax:           +45 8613 1580
E-mail:        sj@soci.au.dk
_________________________________________________________

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