Skip to content

Commit 0116666

Browse files
committed
testing+
1 parent 5a41495 commit 0116666

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

wiki/hypothesis-testing.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ The most basic formula to use here is the one for p-values:
2020
2121
The value for t is then plugged into Welch's t-test.
2222

23+
## Fisher's Exact Test
24+
25+
For a simple test where we test one variable affecting two categories (e.g., a classic A/B test where convert/not-convert are the categories and treatment/control are the variable), the most common method to test for significance is [Fisher's exact test](https://en.wikipedia.org/wiki/Fisher%27s_exact_test). This yields an exact (as opposed to approximated) _p-value_, or the probability of obtaining such a result or a more extreme one under the null hypothesis (of no correlation between variable and categories).
26+
27+
The justification is actually combinatorial, pretty interesting.
28+
29+
A way to run this in Python, given a table with a, b, c, d values for the 4 samples is
30+
`scipy.stats.fisher_exact(table=[[a,b],[c,d]], alternative="less")`
31+
where a and b are the 'converted' counts and c, d the not converted ones, and a, c correspond to control and b, d to treatment (the opposite would also work).
32+
33+
> This value \[the p-value] can be interpreted as the sum of evidence provided by the observed data—or any more extreme table—for the null hypothesis (that there is no difference in the proportions of \[conversion/non-conversion] between \[treatment and control])
34+
35+
For a large enough sample it can be more convenient to use a chi-squared test, which is more powerful but only approximates the p-value -meaning it only works for a larger sample-. A heuristic is that you can start using the chi-squared test if all cells in your table have at least 10 elements.
36+
2337
### P-move
2438

2539
_[Source: Objective Bayesian Two Sample Hypothesis Testing for

0 commit comments

Comments
 (0)