# Given some data, how can I tell how well it fits a (continuous) uniform distribution?

I have a set of $30$ real numbers between zero and one. Let's say that the null hypothesis is that this data set fits a uniform distribution and that the alternative hypothesis is that this data set does not fit a uniform distribution. How would I test this?

My only ideas so far would be to divide the continuous distribution into a set of several categories so that the expected count in each category is at least five. With a set of $30$ numbers, I would divide the interval $(0,1)$ into six equal sections, such as $(0,0.166)$, $(0.166,0.333)$, etc. For each interval, I would count the quantity of data points that fall within the interval. Now that I have converted the original data into categorical data, I can run a chi-squared goodness-of-fit test with (in this case) $5$ degrees of freedom.

The above paragraph is just speculation on my part. Is there a better way to determine how well data fits a uniform distribution?

-
You can only really try to estimate the probability of the data being generated from a uniform distribution. Your alternative model, i.e. "not from a uniform model" is not testable. You have to explicitly specify some distribution. To see this, consider a distribution which is exactly like the uniform model except for some small arbitrary difference. Your data could fit both this distribution (which is not uniform) and the uniform distribution well. See what I mean? – Bitwise May 1 '13 at 1:44
@Bitwise I'll edit "comes from" to "fits." Does that fix the problem? – PhiNotPi May 1 '13 at 1:49
My point is that your alternative hypothesis is meaningless. You could always find some distribution that will fit your data better than the uniform distribution even if the data was actually generated from the uniform distribution. If you are not comparing to some specified distribution you can only calculate how likely your data is given the uniform model. – Bitwise May 1 '13 at 1:56
Okay, then, how would I do that? EDIT: say that I do in fact have an alternative distribution, what should I do in that case? – PhiNotPi May 1 '13 at 2:08