[R] Area between CDFs

Samuelson, Frank* FWS4 at CDRH.FDA.GOV
Wed Feb 18 21:59:55 CET 2004


You may not want to integrate cdfs.  They're already probabilities.  :)
Nice analytic statistics exist for just the maximum distance between
the cdfs, for example.


-----Original Message-----
From: Harold Doran [mailto:hdoran at nasdc.org] 
Sent: Wednesday, February 18, 2004 2:21 PM
To: R Help
Subject: [R] Area between CDFs

Dear List:
I am trying to find the area between two ECDFs. I am examining the gap in
performance between two groups, males and females on a student achievement
test in math, which is a continuous metric.
I start by creating a subset of the dataframe 
male<-subset(datafile, female="Male")
female<-subset(datafile, female="Female")
I then plot the two CDFs via
plot.ecdf(female$math, add=TRUE)
This produces the visual display that reveals a gap in performance. What I
would like to do is learn to perform the integration between the two ECDFs
to examine the size of this gap. 
I would also like to try and examine the horizontal distance between the two
CDFs via another visual display. In other words, the distance between, say
the 50th percentile, from each CDF (or, the distance along the x-axis from
cdf1 to cdf2 at each percentile. Ideally, I would like to plot this
horizontal gap at each percentile.
Secondly, I would like to try and measure and plot the vertical gap, i.e.,
the distance along the y-axis from cdf 1 to cdf2 at each value along the
I am not sure if I first need to smooth the ECDFs before performing these
Any help would be appreciated. I hope this makes sense.
Harold C. Doran
Director of Research and Evaluation
New American Schools
675 N. Washington Street, Suite 220
Alexandria, Virginia 22314

	[[alternative HTML version deleted]]

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list