Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting CDF of a dataset in R?

I am not really sure about the difference between CDF (Cumulative Distribution Function) and ECDF (Empirical Cumulative Distribution Function) but I usually utilize a CDF plot to make observations about my data.

I have been using R recently and am desperately trying to find out how to plot a CDF and CCDF (Complementary CDF) of my data. All I could find was that R has ecdf but am not really sure if this is what I am looking for. Plotting an ECDF is as simple as:

plot.ecdf(data)

Does anyone know how to plot a CDF and CCDF of a dataset using R?

like image 946
Legend Avatar asked Jun 13 '11 19:06

Legend


1 Answers

A CDF commonly requires closed form when you know or assume a distribution. An ECDF, on the other hand, is 'empiricial' as it comes from your data. I just answered a question about using ecdf() and Hmisc's Ecdf() here the other day.

More generally, you can search here using terms such as

 [r] ecdf

in the search box to look for 'ecdf' within the R tag. At rseek.org, little comes up for 'ccdf'. Is that maybe just the same as one minus the ECDF? If so, Ecdf() in Hmisc can do it.

I hope this helps, if not please re-phrase your question as it is not quite clear exactly what you are looking for. Both ecdf() and Ecdf() are pretty featureful so make sure to read their help pages.

like image 114
Dirk Eddelbuettel Avatar answered Sep 21 '22 11:09

Dirk Eddelbuettel