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
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
PharmPK Discussion List Archive Index page
Copyright 1995-2010 David W. A. Bourne (david@boomer.org)