I read with interest a previous question on the PearsonChiSquareTest from a few years ago, and one answer was very helpful:
Performing a chi-square goodness of fit test
Have there been any updates since 2012 for testing counts/frequency data? Although easy to implement manually, I do not understand why testing with the following example data (two 'distributions' of counts?) produces different results to those computed manually:
real = {331, 155, 337, 302, 86} expected = {650.797, 118.261, 325.545, 109.397, 6.99883} With PearsonChiSquareTest[real,expected] the test statistic is only 1.6, and a high p-value. But manually (or using MATLAB or SPSS) the test gives 1400 and a very small p-value (<0.001). It also confusingly gives degrees of freedom as 3 with the PearsonChiSquareTest. Any suggestions/clarification?
PearsonChiSquareTeststates that continuous distributions are being compared. When data is supplied, it is in the form of actual sample values and not counts. You need a different test for what is likely observed counts from a multinomial distribution. (I'm more than a bit surprised that the expected counts are exactly integers - or should the variables be namedreal1andreal2?.) $\endgroup$GeneralizedLinearModelFitwould work for you. But you'd need to give more information about your model, data, and how you obtained the expected values. $\endgroup$