- On 12 Sep 2005 at 12:18:41, "MURAD R. MELHEM" (melhemmr.aaa.email.uc.edu) sent the message

Back to the Top

The following message was posted to: PharmPK

Dear All,

can anyone supply or direct me to a script in S-plus or a way in S-

plus GUI to calculate the area under the curve from zero to last

measured sample using the trapezoidal method.

Many thanks in advance.

Murad - On 12 Sep 2005 at 14:10:19, (nidal.alhuniti.-at-.gmail.com) sent the message

Back to the Top

Hi Murad,

You could use the following Splus function to calculate the AUC to

the last measured sample. Also you could modify the function to get

the AUC to infinity.

AUC <- function(time, conc)

{

tt <- time

yy <- conc

xxx <- sum((sort(tt) - tt)^2)

if(xxx != 0)

stop("Time points must be sorted in ascending order!")

n <- length(tt)

AUC <- sum((yy[-1] + yy[ - n]) * (tt[-1] - tt[ - n]))/2

AUC

}

Nidal Al-Huniti, Ph.D.,

Strategic Consulting Services

Pharsight Corporation

5625 Dillard Drive

Suite 205

Cary, NC 27511

nal-huniti.-a-.pharsight.com

Want to post a follow-up message on this topic? If this link does not work with your browser send a follow-up message to PharmPK@boomer.org with "S-plus and trapezoidal method" as the subject

PharmPK Discussion List Archive Index page

Copyright 1995-2010 David W. A. Bourne (david@boomer.org)