Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Area under the curve trouble with aucdist


From   "Steichen, Thomas" <[email protected]>
To   <[email protected]>, <[email protected]>
Subject   st: RE: Area under the curve trouble with aucdist
Date   Wed, 25 Sep 2002 15:27:20 -0400

Joseph Wagner writes:

> I tried pkexamine but got numerous error messages:
> 
> Warning: the point (0, 0) is not in your data.  It will be added.
> 
> This was my program, I have 876 patients in the dataset.  The 
> only way I could get the program to give me an AUC for each 
> patient was to create a little extra programming:
> 
> by id: pkexamine time conc, trapezoid
> generate auc = r(auc)
> 
> sort id
> qui by id: gen bign=_N
> 
> pkexamine time conc if idd1==1 & bign>2, trapezoid
> generate auc = r(auc) if  & bign>2
> foreach var of varlist idd2-idd876{
> 	pkexamine time conc if `var'==1 & bign>2, trapezoid
> 	replace auc = r(auc) if `var'==1 & bign>2
> }
> 
> Do I need to have -time- initialize at 0?  The variable is in 
> STATA date format.  If it needs to start at 0 I could simply 
> subtract the value for the first -time- from the subsequent 
> observations for each patient.  Please let me know.


1) Is the viral load (concentration) zero at your first time?

Stata's -pk- programs assume you have a (0,0) (time,concentration)
point, which makes sense if you are doing external dosing of
some compound.  

If your concentration is zero at some known start point where
you dose the subject, then it makes sense to assume you want to 
add in the estimated area from time 0 until your first measured
concentration (otherwise you would have to assume an instantaneous
rise to the concentration at the first measured time point). Thus
a (0,0) point makes good sense.

[Aside: Many items of pharmacokinetic interest may have a 
background, intrinsic level in the body... for example, carbon 
monoxide (CO) is formed from natural processes in the body leading 
to non-zero CO and carboxyhemoglobin (COHb) levels despite no 
external dosing of CO.  These situations do not appear to be 
fully covered by the -pk- programs.  One would need to manually
subtract the background levels before computing the AUC.]

2) The -pk- programs also do not assume any true "time" structure
for the time variable (by this, I mean date, hour, minute, etc.). 
Time is simply an increasing set of numbers starting at zero.

Since date variables in Stata are merely integers, they work fine
as long as you scale them back to zero... subtracting the first
data from each of the other dates for a subject works fine...

. sort id date
. by id: gen time = date-date[1]

should create a "time" variable starting at zero from a "date"
variable.

3) If you need AUC for each subject then consider -pkcollapse-.

For your variables (id, time, conc) above, 

. pkcollapse time conc, id(id) trapezoid stat(auc)

will generate a new dataset with one observation per id containing 
the id and the auc computed by the trapezoid method.

Please note that this wipes out (without warning) your existing 
dataset, so be sure you have saved it prior to running -pkcollapse-.

I'm not sure what you are doing with "bign" and "idd1"-"idd876"
above, but it seems extraneous if you use -pkcollapse-.

Tom
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index