Chi Square test on data with the null hypothesis being the data is uniformly distributed in R I've a variable x with 1000 observations.My goal is to prove what kind of distribution e.g.(Uniform or Normal distribution) using Chi square test.Before to this test i've plotted histogram and Gaussian curve to have a visual idea about the distribution but whenever I'm performing a chi square test it returns p-value=1 but i need something less than 0.05 to prove it is a normal distribution.
> chisq.test(D2_test)

D2_test - has a column variable x with some observations after data preprocessing 
Can anyone throw some light on this issue?
Thanks in advance
 A: On saying what distribution your data arose from
You cannot "prove what kind of distribution" your data are from. You can at best say that some distribution isn't implausible (but there will be an infinity of other distributions that are at least as plausible). 
However, in practice distributions that are implausible (in that we can say we would see them generate samples like ours - or samples even less consistent with the null - by chance only very rarely) are quite okay to use as models (i.e. using goodness of fit tests to choose models is not usually the best approach). In sufficiently large samples consistent goodness of fit tests will reject any deviation no matter how inconsequential for our inference.
  
A low p-value doesn't indicate that highly restricted alternative is true
A p-value below 0.05 (or 0.01 or 0.001 or ...) on a test of uniformity doesn't indicate normality -- the data may be from a distinctly non-normal distribution that you can tell from uniformity
-- indeed, in a large sample, your data may look really close to uniform, yet give a low p-value for a test of uniformity; it makes no sense to reject in favor of normality then. 
 
What if uniform and normal are known to be the only possibilities?
If uniform and normal are thought to be the only possibilities, and you must choose between them I would most likely not use a hypothesis test*, and even if I did, I would not consider a chi-squared test at all. It has very poor power for this kind of test.
If you must use a test, one based on the standardized range (range divided by standard deviation, $R/s$) would be a much more powerful test in that case. 
This statistic is used for a test (with normal as the null) in David, Hartley and Pearson (1954), "The Distribution of the Ratio, in a Single Normal Sample, of Range to Standard Deviation", Biometrika, Vol. 41, No. 3/4 (Dec.), pp. 482-493 (originally suggested by Baker, 1946) though more accurate and more extensive tables are in E. S. Pearson and  M. A. Stephens (1964), "The Ratio of Range to Standard Deviation in the Same Normal Sample", 
Biometrika, Vol. 51, No. 3/4 (Dec), pp. 484-487 and its utility for normal null vs uniform alternative is described by Spiegelhalter (1977) "A Test for Normality Against Symmetric Alternatives", Biometrika, Vol. 64, No. 2 (Aug.), pp. 415-418
The same statistic would be appropriate for a test of uniform null vs normal alternative, but a different distribution of the statistic under the null (i.e. different tables) would apply in that case.
* However, if I am choosing between two models (rather than being in the situation where one is a true null), I'd assign a prior to their respective probabilities and use a Bayesian analysis (in which the likelihood would relate to the ratio of range to standard deviation) to choose the one with larger posterior probability. This avoids the arbitrary choice of a null where we don't have one.
