[R] Area between CDFs

Harold Doran hdoran at nasdc.org
Thu Feb 19 20:00:56 CET 2004

Thanks. I have been able to create the following simple function to examine the vertical gap between two CDFs at a value along the x-axis that I specify. For example,  

I create the ECDFs:

I then define the following function:

Now, I can use the function to measure the gap at values along the x-axis (i.e., gap = F(x)-G(x). Also, the CDFs do not cross at any point):


which returns a value that is the size of the gap at a specific score between males and females. 

What I would like to be able to do is measure the vertical gap at each point along the x-axis and then plot the gap. This would illustrate for how large differences in student achievement are at different score values into a nice visual display. 

The brute force way seems to use the function above for each score value. However, this is, of course, inefficient. Any ideas on how I might be able to create a function that would be more efficient?

Many thanks,

Harold C. Doran
Director of Research and Evaluation
New American Schools
675 N. Washington Street, Suite 220
Alexandria, Virginia 22314

-----Original Message-----
From: Thomas Lumley [mailto:tlumley at u.washington.edu]
Sent: Thursday, February 19, 2004 10:49 AM
To: Samuelson, Frank*
Cc: r-help at stat.math.ethz.ch
Subject: RE: [R] Area between CDFs

On Wed, 18 Feb 2004, Samuelson, Frank* wrote:
> 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.

And for the area between cdfs, which is perhaps better known as the
difference in means.


R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list