User Tools

Site Tools


analysis:stat:fisherexacttest

This is an old revision of the document!


Fisher's exact test

InStat example:

Corresponding MATLAB:

% Fisher's exact test
Ns1 = 10; % status 1 (e.g. control)
Ns2 = 10; % status 2 (e.g. stimulation)
status1_prop = 8/2;	% outcome 1 / outcome 2
status2_prop = 1/9;	% outcome 1 / outcome 2
y1 = zeros(1,Ns1);	
y2 = ones(1,Ns2);

x1 = [zeros(1,round(  status1_prop*Ns1 / (1 + status1_prop) )) ones( 1,round(  Ns1 - status1_prop*Ns1 / (1 + status1_prop)  ))];	% status 1 outcome 
x2 = [zeros(1,round(  status2_prop*Ns2 / (1 + status2_prop) )) ones( 1,round(  Ns2 - status2_prop*Ns2 / (1 + status2_prop)  ))];	% status 2 outcome 
	
p = fexact( [x1 x2]', [y1 y2]' )
analysis/stat/fisherexacttest.1418666589.txt.gz · Last modified: 2022/12/29 07:15 (external edit)