# Use Empirical CDF vs Distribution CDF?

NOTE: I purposely did not label the axis due to pending publications. The line colors represent the same data in all three plots.
I fitted my data using a negative binomial distribution to generate a pdf. I am happy with the pdf and meets my research needs. PDF plot:

For when reporting the CDF, should I use the empirical or fitted CDF? There are slight differences between the empirical and fitted CDF, specifically at x = 40, the yellow and cyan lines intersect in the empirical distribution, but not the fitted.

Empirical:

Negative Binomial CDF:

• Why do you need to report CDF (empirical or estimated) when you are happy with the PDF? Commented Jan 16, 2011 at 21:15
• @Suncoolsu, statement of work requires both Commented Jan 16, 2011 at 21:26
• Also I think it is a good question regarding if people should use empirical or fitted cdfs. Commented Jan 16, 2011 at 21:26
• I would go for consistency, if the pdf is fitted, then cdf should be fitted, if pdf is empirical, so is the cdf. Commented Jan 17, 2011 at 7:09
• Consistency is nice, however if you using the empirical cdf, you can provide support (or argue against) your choice of distribution in the pdf Commented Jan 17, 2011 at 17:14

Personally, I'd favour instead showing the fit of the theoretical to the empirical distribution using a set of P-P plots or Q-Q plots.

• Can I use a Q-Q plot instead? I am currently using Matlab and they have a built-in function for Q-Q plots (qqplot) but not R-R plots. Commented Jan 17, 2011 at 3:09
• @Elpezmuerto. Yes pp plot and qqplot try to do the same job. I think QQ plot is as good as PP plot (with subtle differences). But as the great Cleveland, W.S. says, QQ plot is one of the best ways to compare distributions. Commented Jan 17, 2011 at 5:00
• Yes, a Q-Q plot would be fine too. Late last night I had some half-formed idea that a P-P plot would be a bit better in this case, but I've changed my mind in the cold light of morning so edited my answer to reflect this. Commented Jan 17, 2011 at 11:18

The empirical CDF needs to be treated with care at the end points of the data, and in other places where there is "sparse" data. This is because they tend to make weak structural assumptions about what goes on "in between" each data point. It would also be a good idea to have "dots" for the empirical CDF plot rather than lines, or have the dots superimposed over the lines, so that it is easier to see where most of the data actually is. Another alternative is to put the "dots" for the data over the fitted CDF plot, although there may be too much going on in the plot.

Maybe its a plotting difficulty, but the empirical CDF should look like a staircase or step function (horizontal lines with "jumps" at the observed values). The empirical plots above do not look this way, they appear "smoothed". Maybe they are a "non-parametric" CDF using some kind of plot smoother?

If it is a "non-parametric" CDF then you are basically comparing between to models: the negative binomial and the non-parametric one.

My advice: have a separate plot for each data (each colour on a new graph), and then put the empirical CDF as "dots" where the data was observed, and the fitted negative binomial CDF as a smooth line on the same plot. This would look similar to a regression-style scatter plot with a fitted line. An example of the kind of plot I am talking (which has R-code to create it) is here How to present the gain in explained variance thanks to the correlation of Y and X?)

• I used this Matlab function to generate the empirical cdf: mathworks.com/matlabcentral/fileexchange/4426-cdfplot Commented Jan 18, 2011 at 14:54
• Great advice, especially about overlaying the dots on the line plots. Commented Jan 18, 2011 at 15:19
• Maybe its got something to do with the graphics on my PC or this web page, but the plots in the link do look like stair-case functions, but the plots in the question look smooth. Maybe you have a lot of data and the "steps" are so close together you can't see them? Commented Jan 18, 2011 at 15:35
• you would be correct, my posted figure is also from pgfplots to make it look pretty for the report Commented Jan 18, 2011 at 16:56