# What is the proper way to compare discrete set of data to a continuous probability distribution?

I have a set of data points that I an trying to approximate with a few different probability distributions such as the gaussian or student t distributions to see which fits best.

The first step to doing this is plotting the distribution of points themselves. As per my last question, I centered the points around zero and normalized the variance = 1. Now I would like to plot these points to compare to continuous distributions. How does one do this?

I am currently using a histogram method in which I split up the points into $x$ buckets and plot the height of each bucket. Now I realize this doesn't make sense because the resulting distribution of points in the histogram is entirely dependent on the value I choose for $x$.

What is the proper way of doing this? There must be a fundamental concept I'm missing.

-

It sounds to me like your primary difficulty is in binning the data properly. Please pardon me if this is not your question.

You want the total area of the rectangles comprising the histogram to be 1. If you take rectangle height to be the number of data points in the corresponding bin, then the total area will not be 1. Instead, you will have $$\text{area}=(\text{bin width})\times(\text{total number of data points)}.$$ The general principle for handling distributions of binned data properly - which even allows you to deal with variable-width bins - is that rectangle area, rather than rectangle height, should be proportional to the number of data points in the bin. For the fixed-width case, the height of each rectangle should be computed as $$\text{height}= \frac{(\text{number of data points in bin})}{(\text{total number of data points})\times(\text{width of bin})}.$$

If you follow this procedure, then, within reason, the resulting distribution should be relatively insensitive to the number of bins you decide to use. Of course, if you use too many bins, most bins will be empty and you'll get a very spiky distribution, which won't be very illuminating. If you use too few bins, the distribution will be too coarse-grained. The Wikipedia page on histograms describes some commonly used rules, such as Sturges' formula, for deciding how many bins to use.

For testing goodness of fit, you should follow the suggestions in Michael Chernick's answer.

-

Problems like this have been discussed many times. There are numerous goodness of fit tests to use. When you bin the data the chi square test is the test to use. The idea is that you have a distribution that should have frequencies close to those observed from the data. The hypothesized distribution should exhibit close agreement with the data in terms of the bin frequencies. The test decides this by computing for each bin the squared difference of the observed with the expected dividing it by the expected and summing over all the bins. When the distribution hypotheses is the distribution sampled the test statistic has an approximate chi square distrbution.

-

If all you need is an estimate, there are numerous ways to go about it. One such way would be to produce a Q-Q plot of the data vs. the expected distributions (normal, t, etc.). If you are wondering if the data is a normal, you could run Shapiro-Wilk test as well.

Both of these methods are very easy to implement in R or SAS (R is free with open-source code that is easy to find at http://cran.r-project.org/

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8151804208755493, "perplexity": 242.40451303375193}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-35/segments/1408500822053.47/warc/CC-MAIN-20140820021342-00402-ip-10-180-136-8.ec2.internal.warc.gz"}