In this article, the p-value is calculated as 0.32 for observing 55 heads in 100 coin flips.
"In the example of observing 55 heads in 100 coin flips, we calculated a p-value of 0.32. Because the p-value is larger than the 0.05 significance level, we conclude that there is not statistically significant evidence that the coin is unfair."
However, when i try this using scipy
library, here's what i get:
from scipy import stats
n = 100 # Number of coin flips
p = 0.5 # Probability of getting heads with a fair coin
observed_heads = 55 # Observed number of heads
# Calculate the p-value
p_value = 1 - stats.binom.cdf(observed_heads - 1, n, p)
print("P-value:", p_value)
P-value: 0.18410080866334777
How do they calculate p-value of 0.32
?