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