# Hypothesis testing: test involving proportion

I am comparing two diff treatments:

H0: p_t1 = p_t2
Ha: p_t1 ≠ p_t2


Treatment 1: 47030 trials, 5390 worked Treatment 2: 340 trials, 11 worked

from scipy import stats
import numpy as np
trials = np.array([[47030, 5390], [340, 11]])
stats.chi2_contingency(trials)


p-value from above is close to zero so null hyp is rejected. What changes I need to do in my approach to say one treatment is better than other? here I have only tested that they aren't equally effective.....any leads?

• Well, check what the actual proportions are, if your treatment has a higher proportion of successes and you tested that these two proportions are not equal, then... that's it. Mar 29, 2022 at 7:18

That means that 47030 - 5390 = 41640 did not work. For the contingency table, you need the number of "worked" and the number of "did not work", not the number of trials.
The same is true for [340, 11] which should be [329, 11].
It will not change the $$p$$-value a lot in this case, but still.
Once statistical significance is established you can just compare 5390/47030 with 11/340 to see, which one was larger in the sample. The statistical significance then allows you to generalize from the sample to the population.