Loading…

Level Up: Mastering statistics with Python - part 5

Rather than dig into complex math or over-simplify by using a pre-written function, we'll write our own binomial test function, primarily using base Python. In the process, we'll learn more about how hypothesis testing works and build intuition for how to interpret a p-value.

Article hero image

Welcome back! In the fifth session of our series with Codecademy, we'll learn about hypothesis tests by simulating a binomial test.

Much like in the last session, this lesson relies on simulation. Rather than dig into complex math or over-simplify by using a pre-written function, we'll write our own binomial test function, primarily using base Python. In the process, we'll learn more about how hypothesis testing works and build intuition for how to interpret a p-value.

We hope this session provides new insight into the theory behind a null distribution and p-value without requiring any math prerequisites!

Here are some StackOverflow questions related to the work we did in today's session:

Using a binomial test in Python vs R

Using numpy's random.choice function

Understanding a p-value

If you enjoyed this lesson, you can catch up on the rest of the series on YouTube. If you’d like to watch a session live, follow the Codecademy YouTube channel - Codecademy has a new 8 part series on Creative Coding starting March 9th.

Finally, if you want even more stats content, you can sign up for the Master Statistics with Python interactive course this series was based on. This course was developed by Sophie and has many more quizzes, projects, and helpful nuggets that we can’t fit into our streams!

Login with your stackoverflow.com account to take part in the discussion.