analysis:stat:fisherexacttest
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
analysis:stat:fisherexacttest [2014/12/15 18:01] – igorkagan | analysis:stat:fisherexacttest [2022/12/29 07:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
InStat example: | InStat example: | ||
- | {{: | + | {{: |
+ | |||
+ | Corresponding MATLAB: | ||
+ | |||
+ | <code matlab> | ||
+ | |||
+ | %% Fisher' | ||
+ | Ns1 = 10; % condition, or status 1 (e.g. control) | ||
+ | Ns2 = 10; % condition, or status 2 (e.g. stimulation) | ||
+ | |||
+ | % Let's assign arbitrary outcome 2 (" | ||
+ | p_suc1 = 0.2; % probability success in status 1 | ||
+ | p_suc2 = 0.9; % probability success in status 2 | ||
+ | |||
+ | y1 = zeros(1, | ||
+ | y2 = ones(1, | ||
+ | |||
+ | x1 = [zeros(1, | ||
+ | x2 = [zeros(1, | ||
+ | |||
+ | p = fexact( [x1 x2]' , [y1 y2]' ) | ||
+ | |||
+ | |||
+ | % approximating by Binomial distribution, | ||
+ | % http:// | ||
+ | |||
+ | count_success1 = binornd(Ns1, | ||
+ | count_success2 = binornd(Ns2, | ||
+ | |||
+ | y1 = zeros(1, | ||
+ | y2 = ones(1, | ||
+ | |||
+ | for i = 1:100, | ||
+ | x1 = [zeros(1, | ||
+ | x2 = [zeros(1, | ||
+ | |||
+ | p(i) = fexact( [x1 x2]' , [y1 y2]' ); | ||
+ | end | ||
+ | |||
+ | hist(p< | ||
+ | |||
+ | </ | ||
analysis/stat/fisherexacttest.1418666502.txt.gz · Last modified: 2022/12/29 07:15 (external edit)