Last active
January 14, 2023 20:12
-
-
Save lundquist-ecology-lab/ae241c3b8975704b86651e8f63b34c58 to your computer and use it in GitHub Desktop.
Binomial test in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Binomial test in Python | |
from scipy.stats import binom_test | |
# Six-sided die flipped 24 times and lands on three exactly 6 times | |
x = binom_test(x=6, n=24, p=1/6, alternative='greater') | |
print(x) | |
# Flip coin 30 times and it lands on heads exactly 19 times | |
y = binom_test(x=19, n=30, p=1/2, alternative='greater') | |
print(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment