Re: [R] How to calculate the AUC in R

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Tue 12 Apr 2005 - 03:34:38 EST

Dubas, Joćo Paulo wrote:
> Hello R-listers,
>
> I'm working in an experiment that try to determine the degree of
> infection of different clones of a fungus and, one of the measures we
> use to determine these degree is the counting of antibodies in the
> plasma at different dilutions, in this experiment the maximum number of
> dilutions was eleven. I already checked for differences on the maximum
> concentration of the antibodies in function of each clone of the fungus.
> However one measure of interest is the area under the curve (AUC) for
> the counting of antibodies in function of dilution. Unfortunately I
> don't know how to calculate the AUC. Someone can point me an example of
> this procedure or a package that implements this calculation?
>
> Thanks for the help,
> Joćo Paulo Dubas.
>

One of many ways:

trap.rule <- function(x,y) sum(diff(x)*(y[-1]+y[-length(y)]))/2

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Apr 12 11:07:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:07 EST