Introduction to t-tests

Shrishti Vaish
Women Who Code Data Science
4 min readMay 18, 2021

This article is about basic understanding behind statistical tests, which include both z-tests and t-tests. Here I offer a reflection on some key points I recently learned from an online course and felt excited about sharing with the community, as the following examples make the differences between these tests and their applications quite clear.

Statistical tests are used to compare some test statistics such as means and compare the evaluated observed value to an expected value, relative to the standard error.

Let’s begin to learn when to use which test and the intuition behind these tests.

There are four kinds of statistical tests:

  • Z-test
  • T-test (Single Sample)
  • T-test (Dependent)
  • T-test (Independent)

Z-tests

Z-tests are rarely used. Their only application is comparing sample means to population means. Often we can’t know the population parameters, like standard deviation and mean; hence, we instead take a sample to estimate sampling error so as to generalize the results to a population. Z-tests demand that we already know these kinds of population parameters or variances.

T-test (Single Sample)

T-tests are analogous to z-tests. The difference is with a t-test we don’t know the population standard deviation.

Imagine, for example, in a poll, you want to understand if voters from a particular neighborhood are likely to vote differently when compared to the overall voting population. You pull voters from this neighborhood and compare the results to a recent and trustworthy national poll. Here, we use the single sample t-test.

In this case, our neighborhood we are polling is an unknown population with an unknown mean. The hypothesis we are testing is if this unknown population, the neighborhood, has a mean that is different from a specific value — that of the national poll results.

T-test (Dependent, or paired samples)

In dependent T-tests, we have the same set of people measured twice to check if the next-test score minus first-test score is significantly different from zero. If difference exists then you conclude that there is a significant change.

In a poll, you want to understand the effect of a campaign speech on voters’ preferences. You ask a single group of voters to rate their likelihood of voting for the candidate before the speech and again after the speech. Hence, we should use dependent t-test to determine the effect of speech on voters’ preference.

Since the same group of people is observed twice, we sometimes call this type of t-test paired samples, since there are pairs of observations.

T-test (Independent, or two sample)

In independent T-tests, we have different sets of people measured against each other, such as men vs. women, drug vs. placebo, etc.

You are responsible for conducting polls to understand voters’ preferences for a particular political candidate. In the first poll, you want to understand how preferences vary between liberals and conservatives. You ask a group of liberals and a group of conservatives to each rate their likelihood of voting for the candidate. Hence, we should use independent t-test to determine if there’s a significant difference in preferences between these two groups.

Here you can see we have two completely unrelated groups, two different political thought groups. What we check for in the independent t-test is if there is a significant difference between the means of the two groups.

Summary

Today it is key that businesses use statistical analysis to their advantage to retrieve current trends and patterns. Statistical analysis is applied to samples to generalize deductions to their corresponding populations, and hypothesis testing like t-tests are key to this kind of work.

That’s a wrap! I hope this article provides you with rudiments of statistical tests regarding which tests to apply and when. Learn more about Statistics and Data Analysis in my upcoming articles. Stay tuned and follow Women Who Code Data Science for more great articles!

Thank you for reading this article! Don’t forget to clap 👏! If you have any questions, you can write them in the comments💬 section below, and I will do my best to answer them. Connect with me on LinkedIn to know more.

--

--

Shrishti Vaish
Women Who Code Data Science

Business Analyst @Numerator | Program Manager @SheLovesData | Track Lead @WomenWhoCode | AI aspirant