A Statistical Battle — z-Test vs. t-Test

A Statistical Battle — z-Test vs. t-Test

Every person, every day, is faced with decisions that involve numbers. Most of these decisions are based on statistical analysis.

When faced with statistical analysis, we need tests to test for statistical significance. These tests tell us whether the numbers we have represent some actual underlying population parameters or are just random fluctuations in our sample data. The data collected through experiments are precisely that — data points.

Two well-known statistical tests for data are the z-test and the t-test.

This article will compare two statistical hypothesis testing methods.

Please read our blog on Hypothesis Testing.

What is a z-test?

The?z-test is a statistical hypothesis test that compares an experimental set of data with a ‘normal distribution’ or Gaussian.


?The z-test statistic is used to check that your data is normally distributed before looking for outliers.

?Outliers can completely skew your test results if they are given too much weight.

No alt text provided for this image



σ = Sample Standard Deviation n = Sample size

No alt text provided for this image



What is a t-test?

The t-test is a statistical method used to determine if observed data is significantly different from the expected (theoretical) data.


? It is used to identify differences between two means, which are used in testing hypotheses and assumptions of null hypothesis statistical significance testing.

? Clinical trials can help calculate sample size requirements by estimating a treatment’s effect size and the standard deviation of an outcome variable.

No alt text provided for this image


T-test Assumptions

  • Homogeneity of variance. This means you can’t have unequal variances between your samples.
  • Independence: the difference between samples A and B has nothing to do with the order they were tested in.
  • Scale of measurement applied to the data follows a continuous or ordinal scale.
  • The fourth assumption is that data has been collected from a representative and randomly selected portion of the total population.
  • The final assumption is the data when plotted, test results in a normal distribution, bell-shaped distribution curve.

No alt text provided for this image


When should you use each one?

“Statistics is as much about deciding what to do as doing it” (D. S. Sivia, 2008).


The level of significance is above which we can reject the null hypothesis.

The hypothesis testing is the same in both cases (z-test vs. t-test). It’s merely how we test our hypothesis that changes.

If you follow the steps of hypothesis testing, then you’ll find that the last step of hypothesis testing is to compare your test statistic with a table of rejection region boundaries.

If your hypothesis test is for the mean, then you’re going to use a z-test. The steps of hypothesis testing can be found here.

1. State your null hypothesis and alternative hypothesis.

2. Select your significance level and all needed info from sample z test data.

3. Collect data from a random sample(s).

4. Compute what’s called “critical z-score.”

5. Compare critical z-score with your test statistic.

6. If the test statistic is greater than the critical z-score, hence rejecting the null hypothesis and concluding that you have enough evidence to support the alternative hypothesis or else the null hypothesis is not rejected.

If your hypothesis test is for proportions, then you’re going to use a t-test. We compute what’s called a “critical t-value” by dividing our chosen alpha level into our degrees of freedom.

This test has five steps:

1. State your null hypothesis and alternative hypothesis

2. Select your significance level and all needed info for sample t-test data.

3. Collect data from a random sample(s)

4. Compute the test statistic

5. Compare critical t-value.

However, one should weigh the advantages and drawbacks of each test before deciding.

Advantages of z-test:


  • There is a higher chance of detecting differences between groups when the sample size is small (e.g., n < 30).
  • More reliable when working with non-normally distributed data
  • Could lead to greater accuracy when working with multiple groups in one analysis.

But there are disadvantages to using the z-test:

  • Less practical when the number of observations per group is low (<10)
  • Tied to a-priori significance levels
  • The t-test is more powerful when the sample size is small

Advantages of t-test:

  • The number of observations per group does not have to be as large as those required by z-test
  • Multiple hypotheses can be tested sequentially without worrying about an inflated standard error rate.
  • Not tied to a-priori significance levels.

Disadvantages of t-test:

  • z-test tend to be more potent than t-test in terms of statistical power with large sample sizes
  • It does not give good results if outliers are present


Key Takeaway

Figuring out which z-test or t-test is suitable for your data analysis problem can be confusing. On top of choosing the correct statistical test, you must think about sample size, alpha, and data distribution.


It’s no surprise that people take a long time to decide about which test to use when.

Excelsior Data Science programs ?will teach you to avoid common mistakes and make repeatable, accurate results. Follow our step-by-step guide; you’ll learn how to run a t-test or z-test on your data, what hypothesis tests are and how they work, when you should use which one, and a lot more.

So, when someone asks you which test to perform, you can confidently tell them that z-tests are more appropriate for use when trying to measure the effect of one or more independent variables on a single dependent variable. On the other hand, t-tests would be better suited to cases where you need to compare two (or more) dependent

要查看或添加评论,请登录

社区洞察

其他会员也浏览了