# Chi-square test p-value = 1

I am attempting to use the chi-square test as a goodness-of-fitness test in R, but I keep getting a p-value = 1. I expect a high p-value, but less than one. Can anyone point out what error I might be making that would result in such a high p-value?

My null-hypothesis is that my observational distribution follows a binomial distribution listed below.

My expected distribution has a binominal distribution with: z = dbinom(seq(0,256), 256, 1/2).

I have a vector of size 257 representing the frequency distribution of my data (in 257 bins). This distribution has been normalized by the sum of the frequencies.

I am performing the chi-squared test as follows:

> chisq.test(x=hw_hist_v_norm, y=NULL, p=z)

Chi-squared test for given probabilities

data:  hw_hist_v_norm
X-squared = 0, df = 256, p-value = 1

Warning message:
In chisq.test(x = hw_hist_v_norm, y = NULL, p = z) :
Chi-squared approximation may be incorrect


I also tried the original distribution non-normalized as follows:

> chisq.test(x=hw_hists$hw_hist_v, y=NULL, p=z) Chi-squared test for given probabilities data: hw_hists$hw_hist_v
X-squared = 144.9933, df = 256, p-value = 1

Warning message:
In chisq.test(x = hw_hists\$hw_hist_v, y = NULL, p = z) :
Chi-squared approximation may be incorrect


## 1 Answer

Without seeing your hw_hists data, or knowing anything about how they were generated, it is hard to say. However, it appears your data match the binomial distribution incredibly well. One could say that your data match the binomial distribution implausibly well, in fact.

• The frequency data in hw_hists is the result of accumlative data for trillions of samples. Is it possible that the p-value has become asymptotic to 1 because too many samples are being used? – bender Jan 19 '15 at 20:13
• Actually, it works the other way around, @bender. With more & more data, even the most trivial deviations from the binomial would cause the p-value to be 0. – gung - Reinstate Monica Jan 19 '15 at 22:43