arrow

Research Skills

T Test: What to Use and How to Run

Learn how to choose and run the right t test, interpret p values, confidence intervals, and effect sizes, and avoid common statistical mistakes. This guide covers one-sample, paired, and independent t tests, with examples in Excel, R, and Python, plus tips for writing a clear thesis statement.

T Test: What to Use and How to Run

Say two groups have different means. Is the gap real, or did luck cause it? A t test helps you find out. It works for one group, two groups, or the same people measured twice.

What Is a T Test?

It tells us how far an average is from some other number. That number can be a set value, or the average of a second group.

Picture two classes with different average scores. The test shows if that gap probably means something, or if luck could easily explain it.

How It Works

The test compares the size of the gap to the usual wobble in the data. That wobble is called the standard error.

Big gap, small wobble? You get a large t value. That’s a good sign the difference is real.

Next comes the p value. It’s the chance of seeing a gap this big when nothing is really going on. Most people use 0.05 as the cutoff, also called the significance level. “Nothing is going on” is the null hypothesis.

Which Type Should You Pick?

Your situation 

Type 

Example 

One group against a known value 

One sample 

Do coffee cups hold 16 ounces? 

Two separate groups 

Independent samples 

Class A against Class B 

Same people measured twice 

Paired samples 

Blood pressure before and after a drug 

Three or more groups 

Use ANOVA instead 

Four teaching methods 

Using this test on more than two groups underestimates the real error, so ANOVA is the better choice there.

With two separate groups, you’ll meet Student’s version and Welch’s version. Student’s needs both groups to have equal spread. Welch’s doesn’t.

A 2017 paper by Delacre, Lakens and Leys found Welch’s version handles unequal spread better and loses little when spreads match, so they suggest it as the default. Not sure which to use? Go with Welch’s.

You also choose a tail. Pick two tailed if you just want to know “is there a difference?” Pick one tailed only if you chose a direction before you saw the data.

How to Run a T Test Step by Step

Here’s a made up example. Two groups of 8 students tried different study methods.

Method A: 72, 75, 78, 80, 83, 85, 88, 90.
Method B: 65, 68, 70, 73, 75, 77, 80, 82.

  1. Set your hypotheses. The null says both methods give the same average.

  2. Pick a cutoff. We’ll use 0.05, two tailed.

  3. Find the averages. A is 81.4 (standard deviation 6.3). B is 73.8 (standard deviation 5.9).

  4. Find the t value. The gap is 7.6 and the standard error is about 3.05. So t is about 2.50.

  5. Check the p value. With about 14 degrees of freedom, p is about 0.025. That’s under 0.05, so we reject the null.

Don’t stop at p. The 95% confidence interval for the gap is about 1.1 to 14.2 points. Cohen’s d, a common effect size, is about 1.25. That’s large.

The interval is wide because the sample is small.

Here’s how you might write it up: “Method A students (M = 81.4, SD = 6.3) scored higher than Method B students (M = 73.8, SD = 5.9), t(13.9) = 2.50, p = .025, 95% CI [1.1, 14.2].”

Paired and One Sample Examples

Paired first. Six patients had blood pressure checked before and after a drug (made up numbers). Before: 140, 152, 138, 160, 147, 155. After: 132, 148, 135, 151, 145, 146.

The average drop was 5.8 points. That gives t(5) of 4.48 and p near 0.007. Each person is their own control, so pairing is powerful.

Now one sample. A cafe says its large cup holds 16 ounces. We measure 8 cups and the mean is 15.75 ounces. That gives t(7) of negative 2.89 and p near 0.023. The cups hold a little less than claimed.

What the Test Assumes

  1. Your outcome is a number, like weight or score.

  2. Each observation stands alone, unless the data are paired.

  3. The data look roughly like a bell curve, or your sample is fairly big.

  4. Student’s version also needs similar spread in both groups.

Spread is how far values sit from the average. The standard deviation measures it. The coefficient of variation helps when the scales differ.

Outliers can distort results, so plot your data first.

Common Mistakes

  1. Running many tests on three or more groups.

  2. Reading “p below 0.05” as “important.” It only says luck is an unlikely reason.

  3. Picking one tailed after seeing the data.

  4. Skipping the confidence interval and effect size.

  5. Using the paired test on separate groups, or the other way round.

  6. Calling a non significant result proof of no difference. Your sample may just be small.

Read studies a lot? Our guide to quantitative research shows how to judge p values, intervals and effect sizes.

When Another Test Fits Better

Problem 

Try this 

Skewed data, two separate groups 

Mann Whitney U test 

Skewed paired data 

Wilcoxon signed rank test 

Three or more groups 

One way ANOVA 

Counts in categories 

Chi square test 

Yes or no outcomes 

Binomial distribution methods 

Big sample, known population spread 

Z test 

With larger samples, a z test gives results very close to a t test.

Running It in Excel, R and Python

In Excel, use the T.TEST function. Type 1 is paired, type 2 assumes equal spread, and type 3 is Welch’s.

In R, the t.test function uses Welch’s by default.

In Python, SciPy has ttest_ind. Set equal_var to false for Welch’s.

Frequently Asked Questions

Can I use this test for more than two groups?

No. Use ANOVA, then follow up if needed.

What’s the difference between paired and independent samples?

Paired means the same people (or matched pairs) are measured twice. Independent means two separate groups.

What does the p value mean?

It’s the chance of seeing a gap this big if there’s truly no difference. It isn’t the chance that the null is true.

How big should my sample be?

There’s no single number. It depends on the effect size you want to detect, so run a power calculation before you collect data.

How can Canyam help with research papers?

Canyam lets you search research papers and read AI summaries with key findings, methods and citations. That can make it easier to find the methods a paper used.

Final Thoughts

Choosing the right t test comes down to two questions. How many groups do you have, and are the measurements linked? Start with Welch’s for two separate groups, report the interval and effect size, and you’ll dodge most mistakes.