In the previous post, we explained how to calculate P-value and thus perform hypothesis testing for categorical data.
In this post we will give an example.
A study was performed to see if there is a difference between males and females who use cannabis regularly.
The sample size was 134 , 51 Females and 83 Males.
The data result was as follows:
Yes | No | |
M | 61 | 22 |
F | 14 | 37 |
Our Null Hypothesis would be : There is no difference between the proportion of males using cannabis regularly and the proportion of females using cannabis regularly. Namely : H0: p_F = p_M
The two sided alternative hypothesis would be : There is a difference between the proportion of males using cannabis regularly and the proportion of females using cannabis regularly. Namely : HA: p_F != p_M
If we did the calculations we will find the following:
n_F = 51, p_hat_F = 0.2745
n_M = 83, p_hat_M = 0.7349
(absolute) z = 5.2129
p_value = < 0.0001
The following web app will calculate this example. You can use it to any similar data changing the values to your results:
Proportion Test
Group1
Group2
Two-Tailed
One-Tailed
Z value:
P_Value :
Two-sided p_value is 2 x 10 -7
This is a very small number. So we reject the Null hypothesis and conclude that:
There is a statistically significant difference between the proportion of males using cannabis and the proportion of females using cannabis.
Usually, we set the cutoff p value at 0.05. If the p value is less than 0.05 we reject the null hypothesis but if p value is more than 0.05 we fail to reject the null hypothesis.
Always check the cutoff value, which is also known as the significance level or alpha.