Two-Sample t Tests, Power, Effect Size and Sample Size Calculator in Python

Biman Chakraborty
13 min readApr 30, 2023
Photo by Markus Spiske on Unsplash

I was going over my daily dose of coffee while redaing the newspaper in the morning. A habit I grew up with since my teenage days. The only difference over the years is that thirty years ago I used to read two broadsheet newspapers published from my city and now I go over 5 to 6 different newspapers online from different continents. Coming back to the point, some of the headlines following headlines caught my eyes:

  • Why are black women are more likely to die at childbirth?
  • Average monthly rent in UK increased by 173% compared to last year.
  • Does biometric help to improve performance of the NFL players?
  • Gambling reforms are planned to tackle addition

What is common in these stories? They usually refer to research studies that use statistical methods to compare two groups to make inferences. If you pick up any major newspaper on any day, you will find many such similar stories which compares two groups or two treatments (such as black vs non-black, last year vs this year, biometrics vs no biometrics etc.)

In this article I would like to discuss how to compare two groups on a quantitative outcome and how can we use Python to code these statistical inference procedures.

--

--