Fisher's exact test with R×C contingency table

Versione 1.0.0 (4,97 KB) da qqffssxx
This function is based on Monte Carlo simulation, it support contingency tables larger than 2 * 2.
58 download
Aggiornato 15 mar 2023

Visualizza la licenza

The function 'fishertest' provided by MATLAB only supports contingency table of size 2 × 2, and although there have been many other scholarly published functions on File_Exchange to compute larger matrices, the results are somewhat problematic.
This function is based on Monte Carlo simulation, it support contingency tables larger than 2 * 2.
% Input variable: x
% x is the contingency table. You can use function 'crosstab' to generate the contingency table.
% num : the number of Monte Carlo simulations to be performed, default is 100000.
% Output variable: p
% p:p-values
% Source of subfunction 'rcont2': https://people.math.sc.edu/Burkardt/m_src/asa144/asa144.html
% for example
% x = [ 11 11
% 0 6
% 11 17];
% p = fisher_test_R_C(x)
% p = 0.0977;
% Because of the randomness in the algorithm, the result may be different each time.
% You can increase the value of 'num' to make the result more robust.
Reference:
  1. James Boyett,Algorithm AS 144: Random R x C Tables with Given Row and Column Totals,Applied Statistics,Volume 28, Number 3, 1979, pages 329-332.
https://people.math.sc.edu/Burkardt/m_src/asa144/asa144.html

Cita come

qqffssxx (2024). Fisher's exact test with R×C contingency table (https://www.mathworks.com/matlabcentral/fileexchange/126355-fisher-s-exact-test-with-rxc-contingency-table), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2022b
Compatibile con R2010a e release successive
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0