x = [61, 54, 32, 26, 47, 39, 13, 26, 12, 59; 7, 14, 36, 42, 21, 29, 55, 42, 56, 9];
[h, chi, p] = chi2ind(x, 0.05)
Ryan Ward (2021). Pearson Chi-squared test of independence (https://www.mathworks.com/matlabcentral/fileexchange/78339-pearson-chi-squared-test-of-independence), MATLAB Central File Exchange. Retrieved .
Thank you Marius. I used this for a neuroengineering project to find significant transfer of entropy, and no matter what I put in the p value is always zero. Please update your code.
I think the degrees of freedom is incorrectly computed.
They must be
df=r*c-(r+c-1); % =(r-1)*(c-1);
where r is the numbers of rows and c the number of columns. You have the following formula
df = size(chi, 1)-1*size(chi,2);
where size(chi) is always one since chi in your code is scalar.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!