4
$\begingroup$

I have some data that I would like to compare with a theoretical distribution for which I know the parameters. How do I plot the empirical pdf against the theoretical pdf? Perhaps I should add that I would like to plot two continuous pdfs.

Edit:

I am sorry if this problem is more related to Stack Overflow. I actually thought about posting it there but finally changed my mind.

I know that I can use ecdfand ksdensity in MATLAB for example. But what I am looking for is if there exists some better tool to compare pdfs as I am having problem to get two pdfs to overlap. So visual comparison is not that good. The same also goes for CDFs actually, for example plots don't want to overlap when I have shifted distributions.

$\endgroup$
5
  • 2
    $\begingroup$ Welcome to the site, @universalis. Are you interested in ways of thinking about how to visualize these, or do you just need help w/ MATLAB code? Note that the latter would be off-topic for CV (see our help page), but on-topic on Stack Overflow. If the former, please edit to clarify; if the latter, flag your Q & we'll migrate it for you (please don't cross-post, though). $\endgroup$ Commented Jul 9, 2013 at 20:16
  • $\begingroup$ Thank you for clarifying your question, @universalis. It doesn't sound like you want programming advice, but rather to think about how to better visualize & understand these pdfs. That means your question belongs here. +1 $\endgroup$ Commented Jul 9, 2013 at 23:40
  • $\begingroup$ @gung Thank you. You are right, I know how to do this programmatically but fail to understand the outcome of the plots sometimes. Hopefully someone can bring clarity to this. $\endgroup$ Commented Jul 10, 2013 at 7:02
  • $\begingroup$ Would it be possible to post your data as part of your question (if it's not too large), @universalis, or perhaps the plots that you're unsatisfied w/, & maybe some summary statistics (eg, means & sds, or whatever would give people a preliminary sense of the data numerically)? $\endgroup$ Commented Jul 10, 2013 at 14:01
  • $\begingroup$ I'm not entirely clear on the difficulties you mention with the displays you're already aware of. Could you put up some examples illustrating what the difficulty is (or given your rep, upload them to imgur and put the links in your post - sooner or later someone else will incorporate them for you) $\endgroup$
    – Glen_b
    Commented Jul 11, 2013 at 3:06

1 Answer 1

1
$\begingroup$

Assuming you actually know how to make the plot, I guess the only question that remains is that of how to compare 2 distributions that do not fit nicely in one window.

First a small example: Suppose you have a data that is approximately normally distributed with a mean of 100 and a standard deviation of 200, and you want to compare this to the standard normal distribution.

Obviously plotting them together won't help you much, but you can relocate your distribution by correcting the mean, and rescaling it by correcting for the standard deviation. That should give you nicely overlapping graphs.

So much for the thought experiment, if you actually want to compare distributions you can follow the steps as above, but you can also look at plots that are designed for this. I would recommend the QQ plot for example, this should work for most distributions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.