code-for-a-living March 9, 2021

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.

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!

Tags: , , , ,
Podcast logo The Stack Overflow Podcast is a weekly conversation about working in software development, learning to code, and the art and culture of computer programming.

Related

code-for-a-living May 22, 2021

Level Up: Linear Regression in Python – Part 1

Linear regression is a machine learning technique for modeling continuous outcomes. It is used for both prediction and data analysis in a variety of different fields. It is also the basis for a number of other machine learning models, including logistic regression and poisson regression. For anyone who is interested in learning more about data…
code-for-a-living May 29, 2021

Level Up: Linear Regression in Python – Part 2

In the second lesson of the series, we’ll learn how to fit and interpret a simple linear regression with a categorical predictor. We’ll use a simulated dataset to predict the amount of time someone will spend on a website based on the browser they are using. We’ll also predict the rental prices of NYC apartments…
code-for-a-living June 19, 2021

Level Up: Linear Regression in Python – Part 5

In the fifth lesson of the series we’ll learn how to build more flexible linear models by adding interaction and polynomial terms. We’ll fit and inspect our models both mathematically and visually to understand how they work. In the process, we’ll continue to practice our Python skills and discuss some of the merits (and drawbacks)…
code-for-a-living July 3, 2021

Level Up: Linear Regression in Python – Part 7

In the seventh lesson of the series we’ll discuss some methods for comparing linear regression models. In the process, we’ll learn about the problem of overfitting and investigate some of the pros and cons of various evaluation methods (such as R-squared, adjusted R-squared, log likelihood, AIC, and BIC). We’ll also continue to practice our Python…