On Thu, Feb 21, 2019 at 6:34 PM Nicholas Jankowski <address@hidden
do you have a
On Thu, Feb 21, 2019 at 12:44 PM Javier Garcia Falaguera <address@hidden
Many thanks for the support. I just find out that this function
[pval_mu, chisq_mu, df_mu] = chisquare_test_homogeneity (d1, d2, c1)
Doesnt allow any of the values of c1 to be less than 0 (even 0.99 induces to error).
As commented in some mail before, the result is that we get a division by 0, lead to NaN error. It could be great to check it and change it at some point.
As I asked in an earlier email, do you have a good reference we can use for expected behavior, inputs/outputs, maybe a paper or another free open source implementation that we could use as a example... anything?
a trivial test:
>> [a b c]=chisquare_test_homogeneity([.1 .2 .3],[.2 .3 .1],[.7 .8 .9])
a = 1
b = 0
c = 3
no error, and c < 1
just to clarify, NaN is not necessarily an error. it's a result (unless you are getting an actual error message, in which case please report the error message). in this case a divide by zero is caused by the lines:
(x is your d1, y is your d2, c is your c1)
55: n_x = sum (x * ones (1, df+1) < ones (l_x, 1) * c);
58: n_y = sum (y * ones (1, df+1) < ones (l_y, 1) * c);
59: chisq = l_x * l_y * sum ((n_x/l_x - n_y/l_y).^2 ./ (n_x + n_y));
There is no error from putting in c<1 that I can see. the NaN comes from c being smaller than d1 and d2, making n_x and n_y zero, making chisq a divide by zero.
If this isn't what should happen, you should provide some reference that can describe a desired result.