Have a language expert improve your writing

Run a free plagiarism check in 10 minutes, generate accurate citations for free.

  • Knowledge Base

An Introduction to t Tests | Definitions, Formula and Examples

Published on January 31, 2020 by Rebecca Bevans . Revised on June 22, 2023.

A t test is a statistical test that is used to compare the means of two groups. It is often used in hypothesis testing to determine whether a process or treatment actually has an effect on the population of interest, or whether two groups are different from one another.

  • The null hypothesis ( H 0 ) is that the true difference between these group means is zero.
  • The alternate hypothesis ( H a ) is that the true difference is different from zero.

Table of contents

When to use a t test, what type of t test should i use, performing a t test, interpreting test results, presenting the results of a t test, other interesting articles, frequently asked questions about t tests.

A t test can only be used when comparing the means of two groups (a.k.a. pairwise comparison). If you want to compare more than two groups, or if you want to do multiple pairwise comparisons, use an   ANOVA test  or a post-hoc test.

The t test is a parametric test of difference, meaning that it makes the same assumptions about your data as other parametric tests. The t test assumes your data:

  • are independent
  • are (approximately) normally distributed
  • have a similar amount of variance within each group being compared (a.k.a. homogeneity of variance)

If your data do not fit these assumptions, you can try a nonparametric alternative to the t test, such as the Wilcoxon Signed-Rank test for data with unequal variances .

Prevent plagiarism. Run a free check.

When choosing a t test, you will need to consider two things: whether the groups being compared come from a single population or two different populations, and whether you want to test the difference in a specific direction.

What type of t-test should I use

One-sample, two-sample, or paired t test?

  • If the groups come from a single population (e.g., measuring before and after an experimental treatment), perform a paired t test . This is a within-subjects design .
  • If the groups come from two different populations (e.g., two different species, or people from two separate cities), perform a two-sample t test (a.k.a. independent t test ). This is a between-subjects design .
  • If there is one group being compared against a standard value (e.g., comparing the acidity of a liquid to a neutral pH of 7), perform a one-sample t test .

One-tailed or two-tailed t test?

  • If you only care whether the two populations are different from one another, perform a two-tailed t test .
  • If you want to know whether one population mean is greater than or less than the other, perform a one-tailed t test.
  • Your observations come from two separate populations (separate species), so you perform a two-sample t test.
  • You don’t care about the direction of the difference, only whether there is a difference, so you choose to use a two-tailed t test.

The t test estimates the true difference between two group means using the ratio of the difference in group means over the pooled standard error of both groups. You can calculate it manually using a formula, or use statistical analysis software.

T test formula

The formula for the two-sample t test (a.k.a. the Student’s t-test) is shown below.

\begin{equation*}t=\dfrac{\bar{x}_{1}-\bar{x}_{2}}{\sqrt{(s^2(\frac{1}{n_{1}}+\frac{1}{n_{2}}))}}}\end{equation*}

In this formula, t is the t value, x 1 and x 2 are the means of the two groups being compared, s 2 is the pooled standard error of the two groups, and n 1 and n 2 are the number of observations in each of the groups.

A larger t value shows that the difference between group means is greater than the pooled standard error, indicating a more significant difference between the groups.

You can compare your calculated t value against the values in a critical value chart (e.g., Student’s t table) to determine whether your t value is greater than what would be expected by chance. If so, you can reject the null hypothesis and conclude that the two groups are in fact different.

T test function in statistical software

Most statistical software (R, SPSS, etc.) includes a t test function. This built-in function will take your raw data and calculate the t value. It will then compare it to the critical value, and calculate a p -value . This way you can quickly see whether your groups are statistically different.

In your comparison of flower petal lengths, you decide to perform your t test using R. The code looks like this:

Download the data set to practice by yourself.

Sample data set

If you perform the t test for your flower hypothesis in R, you will receive the following output:

T-test output in R

The output provides:

  • An explanation of what is being compared, called data in the output table.
  • The t value : -33.719. Note that it’s negative; this is fine! In most cases, we only care about the absolute value of the difference, or the distance from 0. It doesn’t matter which direction.
  • The degrees of freedom : 30.196. Degrees of freedom is related to your sample size, and shows how many ‘free’ data points are available in your test for making comparisons. The greater the degrees of freedom, the better your statistical test will work.
  • The p value : 2.2e-16 (i.e. 2.2 with 15 zeros in front). This describes the probability that you would see a t value as large as this one by chance.
  • A statement of the alternative hypothesis ( H a ). In this test, the H a is that the difference is not 0.
  • The 95% confidence interval . This is the range of numbers within which the true difference in means will be 95% of the time. This can be changed from 95% if you want a larger or smaller interval, but 95% is very commonly used.
  • The mean petal length for each group.

Here's why students love Scribbr's proofreading services

Discover proofreading & editing

When reporting your t test results, the most important values to include are the t value , the p value , and the degrees of freedom for the test. These will communicate to your audience whether the difference between the two groups is statistically significant (a.k.a. that it is unlikely to have happened by chance).

You can also include the summary statistics for the groups being compared, namely the mean and standard deviation . In R, the code for calculating the mean and the standard deviation from the data looks like this:

flower.data %>% group_by(Species) %>% summarize(mean_length = mean(Petal.Length), sd_length = sd(Petal.Length))

In our example, you would report the results like this:

If you want to know more about statistics , methodology , or research bias , make sure to check out some of our other articles with explanations and examples.

  • Chi square test of independence
  • Statistical power
  • Descriptive statistics
  • Degrees of freedom
  • Pearson correlation
  • Null hypothesis

Methodology

  • Double-blind study
  • Case-control study
  • Research ethics
  • Data collection
  • Hypothesis testing
  • Structured interviews

Research bias

  • Hawthorne effect
  • Unconscious bias
  • Recall bias
  • Halo effect
  • Self-serving bias
  • Information bias

A t-test is a statistical test that compares the means of two samples . It is used in hypothesis testing , with a null hypothesis that the difference in group means is zero and an alternate hypothesis that the difference in group means is different from zero.

A t-test measures the difference in group means divided by the pooled standard error of the two group means.

In this way, it calculates a number (the t-value) illustrating the magnitude of the difference between the two group means being compared, and estimates the likelihood that this difference exists purely by chance (p-value).

Your choice of t-test depends on whether you are studying one group or two groups, and whether you care about the direction of the difference in group means.

If you are studying one group, use a paired t-test to compare the group mean over time or after an intervention, or use a one-sample t-test to compare the group mean to a standard value. If you are studying two groups, use a two-sample t-test .

If you want to know only whether a difference exists, use a two-tailed test . If you want to know if one group mean is greater or less than the other, use a left-tailed or right-tailed one-tailed test .

A one-sample t-test is used to compare a single population to a standard value (for example, to determine whether the average lifespan of a specific town is different from the country average).

A paired t-test is used to compare a single population before and after some experimental intervention or at two different points in time (for example, measuring student performance on a test before and after being taught the material).

A t-test should not be used to measure differences among more than two groups, because the error structure for a t-test will underestimate the actual error when many groups are being compared.

If you want to compare the means of several groups at once, it’s best to use another statistical test such as ANOVA or a post-hoc test.

Cite this Scribbr article

If you want to cite this source, you can copy and paste the citation or click the “Cite this Scribbr article” button to automatically add the citation to our free Citation Generator.

Bevans, R. (2023, June 22). An Introduction to t Tests | Definitions, Formula and Examples. Scribbr. Retrieved August 19, 2024, from https://www.scribbr.com/statistics/t-test/

Is this article helpful?

Rebecca Bevans

Rebecca Bevans

Other students also liked, choosing the right statistical test | types & examples, hypothesis testing | a step-by-step guide with easy examples, test statistics | definition, interpretation, and examples, what is your plagiarism score.

T Test (Student’s T-Test): Definition and Examples

T Test: Contents :

  • What is a T Test?
  • The T Score
  • T Values and P Values
  • Calculating the T Test
  • What is a Paired T Test (Paired Samples T Test)?

What is a T test?

The t test tells you how significant the differences between group means are. It lets you know if those differences in means could have happened by chance. The t test is usually used when data sets follow a normal distribution but you don’t know the population variance .

For example, you might flip a coin 1,000 times and find the number of heads follows a normal distribution for all trials. So you can calculate the sample variance from this data, but the population variance is unknown. Or, a drug company may want to test a new cancer drug to find out if it improves life expectancy. In an experiment, there’s always a control group (a group who are given a placebo, or “sugar pill”). So while the control group may show an average life expectancy of +5 years, the group taking the new drug might have a life expectancy of +6 years. It would seem that the drug might work. But it could be due to a fluke. To test this, researchers would use a Student’s t-test to find out if the results are repeatable for an entire population.

In addition, a t test uses a t-statistic and compares this to t-distribution values to determine if the results are statistically significant .

However, note that you can only uses a t test to compare two means. If you want to compare three or more means, use an ANOVA instead.

The T Score.

The t score is a ratio between the difference between two groups and the difference within the groups .

  • Larger t scores = more difference between groups.
  • Smaller t score = more similarity between groups.

A t score of 3 tells you that the groups are three times as different from each other as they are within each other. So when you run a t test, bigger t-values equal a greater probability that the results are repeatable.

T-Values and P-values

How big is “big enough”? Every t-value has a p-value to go with it. A p-value from a t test is the probability that the results from your sample data occurred by chance. P-values are from 0% to 100% and are usually written as a decimal (for example, a p value of 5% is 0.05). Low p-values indicate your data did not occur by chance . For example, a p-value of .01 means there is only a 1% probability that the results from an experiment happened by chance.

Calculating the Statistic / Test Types

There are three main types of t-test:

  • An Independent Samples t-test compares the means for two groups.
  • A Paired sample t-test compares means from the same group at different times (say, one year apart).
  • A One sample t-test tests the mean of a single group against a known mean.

You can find the steps for an independent samples t test here . But you probably don’t want to calculate the test by hand (the math can get very messy. Use the following tools to calculate the t test:

  • How to do a T test in Excel.
  • T test in SPSS.
  • T-distribution on the TI 89.
  • T distribution on the TI 83.

What is a Paired T Test (Paired Samples T Test / Dependent Samples T Test)?

A paired t test (also called a correlated pairs t-test , a paired samples t test or dependent samples t test ) is where you run a t test on dependent samples. Dependent samples are essentially connected — they are tests on the same person or thing. For example:

  • Knee MRI costs at two different hospitals,
  • Two tests on the same person before and after training,
  • Two blood pressure measurements on the same person using different equipment.

When to Choose a Paired T Test / Paired Samples T Test / Dependent Samples T Test

Choose the paired t-test if you have two measurements on the same item, person or thing. But you should also choose this test if you have two items that are being measured with a unique condition. For example, you might be measuring car safety performance in vehicle research and testing and subject the cars to a series of crash tests. Although the manufacturers are different, you might be subjecting them to the same conditions.

With a “regular” two sample t test , you’re comparing the means for two different samples . For example, you might test two different groups of customer service associates on a business-related test or testing students from two universities on their English skills. But if you take a random sample each group separately and they have different conditions, your samples are independent and you should run an independent samples t test (also called between-samples and unpaired-samples).

The null hypothesis for the independent samples t-test is μ 1 = μ 2 . So it assumes the means are equal. With the paired t test, the null hypothesis is that the pairwise difference between the two tests is equal (H 0 : µ d = 0).

Paired Samples T Test By hand

paired t test example 2

  • The “ΣD” is the sum of X-Y from Step 2.
  • ΣD 2 : Sum of the squared differences (from Step 4).
  • (ΣD) 2 : Sum of the differences (from Step 2), squared.

If you’re unfamiliar with the Σ notation used in the t test, it basically means to “add everything up”. You may find this article useful: summation notation .

paired t test example 7v3

Step 6: Subtract 1 from the sample size to get the degrees of freedom. We have 11 items. So 11 – 1 = 10.

Step 7: Find the p-value in the t-table , using the degrees of freedom in Step 6. But if you don’t have a specified alpha level , use 0.05 (5%).

So for this example t test problem, with df = 10, the t-value is 2.228.

Step 8: In conclusion, compare your t-table value from Step 7 (2.228) to your calculated t-value (-2.74). The calculated t-value is greater than the table value at an alpha level of .05. In addition, note that the p-value is less than the alpha level: p <.05. So we can reject the null hypothesis that there is no difference between means.

However, note that you can ignore the minus sign when comparing the two t-values as ± indicates the direction; the p-value remains the same for both directions.

In addition, check out our YouTube channel for more stats help and tips!

Goulden, C. H. Methods of Statistical Analysis, 2nd ed. New York: Wiley, pp. 50-55, 1956.

hypothesis testing with t test examples

User Preferences

Content preview.

Arcu felis bibendum ut tristique et egestas quis:

  • Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
  • Duis aute irure dolor in reprehenderit in voluptate
  • Excepteur sint occaecat cupidatat non proident

Keyboard Shortcuts

S.3.3 hypothesis testing examples.

  • Example: Right-Tailed Test
  • Example: Left-Tailed Test
  • Example: Two-Tailed Test

Brinell Hardness Scores

An engineer measured the Brinell hardness of 25 pieces of ductile iron that were subcritically annealed. The resulting data were:

Brinell Hardness of 25 Pieces of Ductile Iron
170 167 174 179 179 187 179 183 179
156 163 156 187 156 167 156 174 170
183 179 174 179 170 159 187    

The engineer hypothesized that the mean Brinell hardness of all such ductile iron pieces is greater than 170. Therefore, he was interested in testing the hypotheses:

H 0 : μ = 170 H A : μ > 170

The engineer entered his data into Minitab and requested that the "one-sample t -test" be conducted for the above hypotheses. He obtained the following output:

Descriptive Statistics

N Mean StDev SE Mean 95% Lower Bound
25 172.52 10.31 2.06 168.99

$\mu$: mean of Brinelli

Null hypothesis    H₀: $\mu$ = 170 Alternative hypothesis    H₁: $\mu$ > 170

T-Value P-Value
1.22 0.117

The output tells us that the average Brinell hardness of the n = 25 pieces of ductile iron was 172.52 with a standard deviation of 10.31. (The standard error of the mean "SE Mean", calculated by dividing the standard deviation 10.31 by the square root of n = 25, is 2.06). The test statistic t * is 1.22, and the P -value is 0.117.

If the engineer set his significance level α at 0.05 and used the critical value approach to conduct his hypothesis test, he would reject the null hypothesis if his test statistic t * were greater than 1.7109 (determined using statistical software or a t -table):

t distribution graph for df = 24 and a right tailed test of .05 significance level

Since the engineer's test statistic, t * = 1.22, is not greater than 1.7109, the engineer fails to reject the null hypothesis. That is, the test statistic does not fall in the "critical region." There is insufficient evidence, at the \(\alpha\) = 0.05 level, to conclude that the mean Brinell hardness of all such ductile iron pieces is greater than 170.

If the engineer used the P -value approach to conduct his hypothesis test, he would determine the area under a t n - 1 = t 24 curve and to the right of the test statistic t * = 1.22:

t distribution graph of right tailed test showing the p-value of 0117 for a t-value of 1.22

In the output above, Minitab reports that the P -value is 0.117. Since the P -value, 0.117, is greater than \(\alpha\) = 0.05, the engineer fails to reject the null hypothesis. There is insufficient evidence, at the \(\alpha\) = 0.05 level, to conclude that the mean Brinell hardness of all such ductile iron pieces is greater than 170.

Note that the engineer obtains the same scientific conclusion regardless of the approach used. This will always be the case.

Height of Sunflowers

A biologist was interested in determining whether sunflower seedlings treated with an extract from Vinca minor roots resulted in a lower average height of sunflower seedlings than the standard height of 15.7 cm. The biologist treated a random sample of n = 33 seedlings with the extract and subsequently obtained the following heights:

Heights of 33 Sunflower Seedlings
11.5 11.8 15.7 16.1 14.1 10.5 9.3 15.0 11.1
15.2 19.0 12.8 12.4 19.2 13.5 12.2 13.3  
16.5 13.5 14.4 16.7 10.9 13.0 10.3 15.8  
15.1 17.1 13.3 12.4 8.5 14.3 12.9 13.5  

The biologist's hypotheses are:

H 0 : μ = 15.7 H A : μ < 15.7

The biologist entered her data into Minitab and requested that the "one-sample t -test" be conducted for the above hypotheses. She obtained the following output:

N Mean StDev SE Mean 95% Upper Bound
33 13.664 2.544 0.443 14.414

$\mu$: mean of Height

Null hypothesis    H₀: $\mu$ = 15.7 Alternative hypothesis    H₁: $\mu$ < 15.7

T-Value P-Value
-4.60 0.000

The output tells us that the average height of the n = 33 sunflower seedlings was 13.664 with a standard deviation of 2.544. (The standard error of the mean "SE Mean", calculated by dividing the standard deviation 13.664 by the square root of n = 33, is 0.443). The test statistic t * is -4.60, and the P -value, 0.000, is to three decimal places.

Minitab Note. Minitab will always report P -values to only 3 decimal places. If Minitab reports the P -value as 0.000, it really means that the P -value is 0.000....something. Throughout this course (and your future research!), when you see that Minitab reports the P -value as 0.000, you should report the P -value as being "< 0.001."

If the biologist set her significance level \(\alpha\) at 0.05 and used the critical value approach to conduct her hypothesis test, she would reject the null hypothesis if her test statistic t * were less than -1.6939 (determined using statistical software or a t -table):s-3-3

Since the biologist's test statistic, t * = -4.60, is less than -1.6939, the biologist rejects the null hypothesis. That is, the test statistic falls in the "critical region." There is sufficient evidence, at the α = 0.05 level, to conclude that the mean height of all such sunflower seedlings is less than 15.7 cm.

If the biologist used the P -value approach to conduct her hypothesis test, she would determine the area under a t n - 1 = t 32 curve and to the left of the test statistic t * = -4.60:

t-distribution for left tailed test with significance level of 0.05 shown in left tail

In the output above, Minitab reports that the P -value is 0.000, which we take to mean < 0.001. Since the P -value is less than 0.001, it is clearly less than \(\alpha\) = 0.05, and the biologist rejects the null hypothesis. There is sufficient evidence, at the \(\alpha\) = 0.05 level, to conclude that the mean height of all such sunflower seedlings is less than 15.7 cm.

t-distribution graph for left tailed test with a t-value of -4.60 and left tail area of 0.000

Note again that the biologist obtains the same scientific conclusion regardless of the approach used. This will always be the case.

Gum Thickness

A manufacturer claims that the thickness of the spearmint gum it produces is 7.5 one-hundredths of an inch. A quality control specialist regularly checks this claim. On one production run, he took a random sample of n = 10 pieces of gum and measured their thickness. He obtained:

Thicknesses of 10 Pieces of Gum
7.65 7.60 7.65 7.70 7.55
7.55 7.40 7.40 7.50 7.50

The quality control specialist's hypotheses are:

H 0 : μ = 7.5 H A : μ ≠ 7.5

The quality control specialist entered his data into Minitab and requested that the "one-sample t -test" be conducted for the above hypotheses. He obtained the following output:

N Mean StDev SE Mean 95% CI for $\mu$
10 7.550 0.1027 0.0325 (7.4765, 7.6235)

$\mu$: mean of Thickness

Null hypothesis    H₀: $\mu$ = 7.5 Alternative hypothesis    H₁: $\mu \ne$ 7.5

T-Value P-Value
1.54 0.158

The output tells us that the average thickness of the n = 10 pieces of gums was 7.55 one-hundredths of an inch with a standard deviation of 0.1027. (The standard error of the mean "SE Mean", calculated by dividing the standard deviation 0.1027 by the square root of n = 10, is 0.0325). The test statistic t * is 1.54, and the P -value is 0.158.

If the quality control specialist sets his significance level \(\alpha\) at 0.05 and used the critical value approach to conduct his hypothesis test, he would reject the null hypothesis if his test statistic t * were less than -2.2616 or greater than 2.2616 (determined using statistical software or a t -table):

t-distribution graph of two tails with a significance level of .05 and t values of -2.2616 and 2.2616

Since the quality control specialist's test statistic, t * = 1.54, is not less than -2.2616 nor greater than 2.2616, the quality control specialist fails to reject the null hypothesis. That is, the test statistic does not fall in the "critical region." There is insufficient evidence, at the \(\alpha\) = 0.05 level, to conclude that the mean thickness of all of the manufacturer's spearmint gum differs from 7.5 one-hundredths of an inch.

If the quality control specialist used the P -value approach to conduct his hypothesis test, he would determine the area under a t n - 1 = t 9 curve, to the right of 1.54 and to the left of -1.54:

t-distribution graph for a two tailed test with t values of -1.54 and 1.54, the corresponding p-values are 0.0789732 on both tails

In the output above, Minitab reports that the P -value is 0.158. Since the P -value, 0.158, is greater than \(\alpha\) = 0.05, the quality control specialist fails to reject the null hypothesis. There is insufficient evidence, at the \(\alpha\) = 0.05 level, to conclude that the mean thickness of all pieces of spearmint gum differs from 7.5 one-hundredths of an inch.

Note that the quality control specialist obtains the same scientific conclusion regardless of the approach used. This will always be the case.

In our review of hypothesis tests, we have focused on just one particular hypothesis test, namely that concerning the population mean \(\mu\). The important thing to recognize is that the topics discussed here — the general idea of hypothesis tests, errors in hypothesis testing, the critical value approach, and the P -value approach — generally extend to all of the hypothesis tests you will encounter.

The t-test is a statistical test procedure that tests whether there is a significant difference between the means of two groups.

t-Test

The two groups could be, for example, patients who received drug A once and drug B once, and you want to know if there is a difference in blood pressure between these two groups.

Types of t-test

There are three different types of t-tests. The one sample t-test , the independent-sample t-test and the paired-sample t-test .

Types of t-test

One sample t-Test

When do we use the one sample t-test (simple t-test) ? We use the one sample t-test when we want to compare the mean of a sample with a known reference mean.

One sample t-Test

Example of a one sample t-test

A manufacturer of chocolate bars claims that its chocolate bars weigh 50 grams on average. To verify this, a sample of 30 bars is taken and weighed. The mean value of this sample is 48 grams.

Example one  sample t-test

We can now perform a one sample t-test to see if the mean of 48 grams is significantly different from the claimed 50 grams.

t-test for independent samples

When to use the t-test for independent samples ? We use the t-test for independent samples when we want to compare the means of two independent groups or samples. We want to know if there is a significant difference between these means.

t-test for independent samples

Example of a t-test for independent samples

We would like to compare the effectiveness of two painkillers, drug A and drug B .

Example of a t-test for independent samples

To do this, we randomly divide 60 test subjects into two groups. The first group receives drug A , the second group receives drug B . With an independent t-test we can now test whether there is a significant difference in pain relief between the two drugs.

Paired samples t-Test

When to use the t-test for dependent samples (paired t-test) ? The t-test for dependent samples is used to compare the means of two dependent groups.

Paired samples t-Test

Example of the t-test for paired samples

We want to know how effective a diet is. To do this, we weigh 30 people before the diet and exactly the same people after the diet.

Example of the t-test for paired samples

Now we can see for each person how big the weight difference is between before and after . With a dependent t-test we can now check whether there is a significant difference.

Dependent vs. independent sample

In a dependent sample (paired sample), the measured values are available in pairs. The pairs are created, for example, by repeated measurements on the same persons. Independent samples (unpaired sample) result from persons and measurements that are independent of each other.

Paired vs unpaired sample

The t-test for dependent samples is very similar to the t-test for one sample. We can also think of the t-test for dependent samples as having a sample that was measured at two different times. As shown in the following image, we then calculate the difference between the paired values and get a value for one sample.

t-test for one sample and t-test for dependent sample

Once we get -5 , once +2 , once -1 and so on. Now we want to check whether the mean of the just calculated differences deviates from a reference value. In this case, zero. And that is exactly what the t-test does for a sample.

Assumptions

What are the assumptions to be able to calculate a t-test in the first place? First, of course, we must have a suitable sample.

  • For the one sample t-test we need a sample and a reference value.
  • In an independent t-test, we need two independent samples.
  • And with the paired t-test, we need a dependent sample.

The variable for which it is to be tested whether there is a difference between the means must be metric. Metric variables are e.g. age, body weight, income. A non-metric variable is, for example, a person's school-leaving qualification (Secondary School, High School,...).

Furthermore, the metric variable must be normally distributed in all three variants of the t-test.

Assumptions t-test

You can find out how to test whether your data are normally distributed in the tutorial on testing for normal distribution .

For the dependent t-test, the variances in the two groups must still be approximately equal. You can check whether the variances are equal with the Levene test .

So what are the hypotheses for the t-test? Let's start with the one sample t-test.

t-test for one sample

In the one sample t-test, the null hypothesis and the alternative hypothesis are:

  • Null hypothesis: The sample mean is equal to the given reference value (so there is no difference).
  • Alternative hypothesis: The sample mean is not equal to the given reference value (so there is a difference).

What about the t-test for independent samples? In the independent t-test, hypotheses are:

  • Null hypothesis: The means in the two groups are equal (so there is no difference between the two groups).
  • Alternative hypothesis: The mean values in the two groups are not equal (i.e. there is a difference between the two groups).

t-test for paired samples

And finally, the t-test for paired samples. In the paired t-test, the hypotheses are:

  • Null hypothesis: The mean of the differences between the pairs is zero.
  • Alternative hypothesis: The mean of the differences between the pairs is non-zero.

Why do we need a t-test?

Let's say we have made a hypothesis:

There is a difference in the duration of studying between men and women in Germany.

Our basic population is therefore all graduates of a degree programme in Germany. Since we cannot, of course, survey all graduates, we draw a sample that is as representative as possible.

t-Test Sample

With the t-test we now test the null hypothesis that there is no difference in the population.

If there is no difference in the population, then we will certainly still see a difference in study duration in the sample. It would be very unlikely that we would draw a sample where the difference is exactly zero.

Why do you need a t-test

In simple terms, we now want to know at what difference, measured in the sample, we can say that the length of study of men and women is significantly different. And this is exactly what the t-test answers.

Calculate t-test

How do you calculate a t-test? First the t-value is needed:

To calculate the t-value, we need two values. First, we need the difference of the means and second, the standard deviation from the mean. This value is called the standard error.

Calculate t-value

In the sample t-test , we calculate the difference between the sample mean and the known reference mean. s is the standard deviation of the data collected and n is the number of cases.

t-value in the one sample t-test

s divided by the square root of n is then the standard deviation from the mean or the standard error.

t-value standard error

In the t-test for independent samples , the difference is simply calculated from the difference of the two sample means.

t-value in t-test independent samples

To calculate the standard error, we need the standard deviation and the number of cases of the first and the second sample.

Depending on whether we can assume equal or unequal variances for our data, there are different formulas for the standard error. More on this in the tutorial on the t-test for independent samples .

With a paired samples t-test , we only need to calculate the difference of the paired values and calculate the mean from this. The standard error is then the same as in the t-test for one sample.

t-value in paired samples t-test

Interpret t-value

Regardless of which t-test we calculate, the t-value becomes larger the greater the difference between the means. In the same way, the t-value becomes smaller when the difference between the means is smaller.

Interpret t-value

Also, the t-value becomes smaller if we have a larger dispersion of the mean values. So the greater the scatter of the data, the less a given mean difference matters!

The t-value and the null hypothesis

We now want to use the t-test to find out whether we reject the null hypothesis or not. To do this, we can use the t-value in two ways. Either we read the so-called critical t-value from a table or we simply calculate the p-value with the help of the t-value.

The t-value and the null hypothesis

Let's start with the method involving the critical t-value, which we can read from a table. To do this, we first need the table of critical t-values , which we can find on datatab.net, under "Tutorials" and "t-distribution". Let's start with the two-sided case first, which is a one-sided or directed hypothesis. Below we see the table.

Table t-distribution

First we have to determine which significance level we want to use. Here we choose a significance level of 0.05, i.e. 5%. Then we have to look in the column at 1-0.05, so at 0.95.

Now we need the degrees of freedom. In the one sample t-test and the dependent-sample t-test, the degrees of freedom are simply the number of cases minus 1. So if we have a sample of 10 people, we have 9 degrees of freedom. In the independent samples t-test, we add the number of people from the two samples and calculate minus 2 because we have two samples. It should be noted that the degrees of freedom can also be determined in other ways, depending on whether one assumes equal or unequal variance.

t-test Degrees of freedom

So if we have a significance level of 5% and 9 degrees of freedom, we get a critical t-value of 2.262.

On the one hand, we have now calculated a t-value with the t-test, and then we have the critical t-value. If the calculated t-value is greater than the critical t-value, we reject the null hypothesis. Suppose we have calculated a t-value of 2.5. This value is greater than 2.262 and thus the two means are so far apart that we can reject the null hypothesis.

On the other hand, we can also calculate the p-value for the t-value we calculated. If we enter 2.5 for the t-value and 9 for the degrees of freedom at the green marked region of the image, we get a p-value of 0.034. The p-value is smaller than 0.05 and thus we also reject the null hypothesis in this way.

Calculate p-value for t-test

As a check, if we enter the t-value of 2.262, we get exactly a p-value of 0.05, which is exactly the limit.

t-test significant p-value

Calculate the t-Test with DATAtab

If you want to calculate a t-test with DATAtab , all you have to do is copy your own data into the table, click on "Hypothesis Test" and then select the desired variables.

Calculate t-test online

For example, if you want to check whether gender has an influence on income, simply click on both variables and a t-test for independent samples is automatically calculated. You can then read the p-value at the bottom.

t-test results

If you are still unsure how to interpret the results, you can simply click on "Interpretation in words":

Directed and undirected hypothesis

The final question that now arises is what is the difference between a one tailed or directed hypothesis and a two tailed or undirected hypothesis. In the undirected case, the alternative hypothesis is that there is a difference between, e.g. men's and women's wages.

one tailed t-Test

In this case, we are not interested in which of the two earns more, we only want to know whether there is a difference or not. With a directed hypothesis, we are also interested in the direction of the difference. The alternative hypothesis is then, for example, men earn more than women or women earn more than men.

If we look at this graphically with the t-distribution, we see that in the two-sided case we have one range on the left and one on the right. We want to reject the null hypothesis if we are in either of them. At a significance level of 5%, both ranges have a probability of 2.5%, so together they have 5%.

When we test a one-sided t-test, we only reject the null hypothesis if we are in this range, always depending on the sign (the side) we are testing. In that case, With a significance level of 5%, the entire 5% then falls within this range.

One-sided t-test

Statistics made easy

  • many illustrative examples
  • ideal for exams and theses
  • statistics made easy on 412 pages
  • 5rd revised edition (April 2024)
  • Only 8.99 €

Datatab

"Super simple written"

"It could not be simpler"

"So many helpful examples"

Statistics Calculator

Cite DATAtab: DATAtab Team (2024). DATAtab: Online Statistics Calculator. DATAtab e.U. Graz, Austria. URL https://datatab.net

Learn Math and Stats with Dr. G

A shortcut is the longest distance between two points.

Learn Math and Stats with Dr. G

One Sample T-Test Hypothesis Test By Hand

A t-test hypothesis test example By Hand

A coffee shop relocates to Italy and wants to make sure that all lattes are consistent. They believe that each latte has an average of 4 oz of espresso. If this is not the case, they must increase or decrease the amount. A random sample of 25 lattes shows a mean of 4.6 oz of espresso and a standard deviation of .22 oz. Use alpha = .05 and run a one sample t-test to compare with the known population mean.

Step 1: What is Ho and Ha?

Ho: mean amount of espresso in a latte = 4 oz Ha: mean amount of espresso in a latte NOT= 4oz.

Should you use t-test or z-test and why? This is best as a t-test because our sample size is smaller (less than 30) and we know the sample standard deviation, but not the population standard deviation.

Remember: Given any data set, you can always calculate the standard deviation which is the square root of the variance. Is this a one or two tailed test?

Notice that this is a TWO-TAILED test . However, if the question had asked if the amount is greater or less than, the test would have been different and would have been one-tailed.

It is also possible to run a one-tailed test here because the sample mean is greater than the population mean. However, in this example, we will run the two-tailed test.

Our sample size n = 25.

Step 2: Calculating the t-test statistic (one sample t-test)

NOTE: There are three types of t-tests. There is the one sample t-test that compares a single sample to a known population value (this example). There is an independent samples t-test that compares two samples to each other. There is a paired data (also called correlated data) t-test that compares two samples from data that is related (like pretest score and post test score).

t -test = (sample mean – population mean)/[stddev/sqrt(n)]

The sample mean “x” is 4.6 oz The “mean” is the population mean of 4 oz. The sample std dev is .22 oz

n = 25 df = n – 1 = 24 t -test = (sample mean – population mean)/[stddev/sqrt(n)] =(4.6 – 4) / [.22/sqrt(25)] = (.6)/[.22/5] = .6/.044 = 13.6

Therefore, the t-test value is 13.6

But – this is not the end of the test!

Step 3: Determine if this value is in a rejection region (reject Ho) or not (do not reject Ho)

Next, using any t-table (these tables are always on the internet) we can get the critical values (tc) for the two tailed test.

Our degrees of freedom for this one sample t-test is :

df = n – 1 = 25 – 1 = 24

Our alpha value is .05

Our test is two-tailed

Therefore, using any t-table, the two “critical values” that represent the cut-off points for rejection are:

tc = +/- 2.064

This tells is that if our t-test result (which in this case is 13.6) is either bigger than 2.064 or less than -2.064 then we CAN reject the null because we ARE in the rejection region.

13.6 > 2.064

Step 4: Understanding and writing the conclusion – what does this all mean

Recall that Ho says that there is no sig diff between our sample mean of the amount of espresso in the coffee in Italy and the expected population amount. Ho always says that there is no sig diff.

However, in this case, we REJECT Ho. In other words, we do not agree with Ho. We do not think that Ho is correct (with a .05 error margin).

Because we reject Ho (do not choose Ho) we then choose Ha.

Ha tells us that there IS A SIG DIFF between the amount of espresso in the Italy coffee versus the expected mean.

So – there is too much espresso being placed in the coffee in Italy and it should be reduced to meet the normal (population) mean.

  • Math Formulas
  • T Test Formula

Top Banner

T-Test Formula

The t-test is any statistical hypothesis test in which the test statistic follows a Student’s t-distribution under the null hypothesis. It can be used to determine if two sets of data are significantly different from each other, and is most commonly applied when the test statistic would follow a normal distribution if the value of a scaling term in the test statistic were known.

T-test uses means and standard deviations of two samples to make a comparison. The formula for T-test is given below:

\begin{array}{l}\qquad t=\frac{\bar{X}_{1}-\bar{X}_{2}}{s_{\bar{\Delta}}} \\ \text { where } \\ \qquad s_{\bar{\Delta}}=\sqrt{\frac{s_{1}^{2}}{n_{1}}+\frac{s_{2}^{2}}{n_{2}}} \\ \end{array}

Where, \(\begin{array}{l}\overline{x}\end{array} \) = Mean of first set of values \(\begin{array}{l}\overline{x}_{2}\end{array} \)  = Mean of second set of values \(\begin{array}{l}S_{1}\end{array} \)   = Standard deviation of first set of values \(\begin{array}{l}S_{2}\end{array} \)   = Standard deviation of second set of values \(\begin{array}{l}n_{1}\end{array} \)   = Total number of values in first set \(\begin{array}{l}n_{2}\end{array} \)   = Total number of values in second set.

The formula for standard deviation is given by:

Where, x = Values given \(\begin{array}{l}\overline{x}\end{array} \) = Mean n = Total number of values.

T-Test Solved Examples

Question 1: Find the t-test value for the following two sets of values: 7, 2, 9, 8 and 1, 2, 3, 4?

Formula for standard deviation:  \(\begin{array}{l}S=\sqrt{\frac{\sum\left(x-\overline{x}\right)^{2}}{n-1}}\end{array} \)

Number of terms in first set:  \(\begin{array}{l}n_{1}\end{array} \) = 4

Mean for first set of data: \(\begin{array}{l}\overline{x}_{1}\end{array} \) = 6.5

Construct the following table for standard deviation:

7 0.5 0.25
2 -4.5 20.25
9 2.5 6.25
8 1.5 2.25

Standard deviation for the first set of data: S 1 = 3.11

Number of terms in second set: n 2 = 4

1 -1.5 2.25
2 -0.5 0.25
3 0.5 0.25
4 1.5 2.25

Standard deviation for first set of data: \(\begin{array}{l}S_{2}\end{array} \) = 1.29

Formula for t-test value:

t = 2.3764 = 2.36 (approx)

More topics in T Test Formula
FORMULAS Related Links

Leave a Comment Cancel reply

Your Mobile number and Email id will not be published. Required fields are marked *

Request OTP on Voice Call

Post My Comment

hypothesis testing with t test examples

Register with BYJU'S & Download Free PDFs

Register with byju's & watch live videos.

Calcworkshop

One Sample T Test Easily Explained w/ 5+ Examples!

// Last Updated: October 9, 2020 - Watch Video //

Did you know that a hypothesis test for a sample mean is the same thing as a one sample t-test?

Jenn (B.S., M.Ed.) of Calcworkshop® teaching one sample t test

Jenn, Founder Calcworkshop ® , 15+ Years Experience (Licensed & Certified Teacher)

Learn the how-to with 5 step-by-step examples.

Let’s go!

What is a One Sample T Test?

A one sample t-test determines whether or not the sample mean is statistically different (statistically significant) from a population mean.

While significance tests for population proportions are based on z-scores and the normal distribution, hypothesis testing for population means depends on whether or not the population standard deviation is known or unknown.

For a one sample t test, we compare a test variable against a test value. And depending on whether or not we know the population standard deviation will determine what type of test variable we calculate.

T Test Vs. Z Test

So, determining whether or not to use a z-test or a t-test comes down to four things:

  • Are we are working with a proportion (z-test) or mean (z-test or t-test)?
  • Do you know the population standard deviation (z-test)?
  • Is the population normally distributed (z-test)?
  • What is the sample size? If the sample is less than 30 (t-test), if the sample is larger than 30 we can apply the central limit theorem as population is approximately normally.

How To Calculate a Test Statistic

Standard deviation known.

If the population standard deviation is known , then our significance test will follow a z-value. And as we learned while conducting confidence intervals, if our sample size is larger than 30, then our distribution is normal or approximately normal. And if our sample size is less than 30, we apply the Central Limit Theorem and deem our distribution approximately normal.

z test statistic formula

Z Test Statistic Formula

Standard Deviation Unknown

If the population standard deviation is unknown , we will use a sample standard deviation that will be close enough to the unknown population standard deviation. But this will also cause us to have to use a t-distribution instead of a normal distribution as noted by StatTrek .

Just like we saw with confidence intervals for population means, the t-distribution has an additional parameter representing the degrees of freedom or the number of observations that can be chosen freely.

t test statistic formula

T Test Statistic Formula

This means that our test statistic will be a t-value rather than a z-value. But thankfully, how we find our p-value and draw our final inference is the same as for hypothesis testing for proportions, as the graphic below illustrates.

how to find the p value

How To Find The P Value

Example Question

For example, imagine a company wants to test the claim that their batteries last more than 40 hours. Using a simple random sample of 15 batteries yielded a mean of 44.9 hours, with a standard deviation of 8.9 hours. Test this claim using a significance level of 0.05.

one sample t test example

One Sample T Test Example

How To Find P Value From T

So, our p-value is a probability, and it determines whether our test statistic is as extreme or more extreme then our test value, assuming that the null hypothesis is true. To find this value we either use a calculator or a t-table, as we will demonstrate in the video.

We have significant evidence to conclude the company’s claim that their batteries last more than 40 hours.

what does the p value mean

What Does The P Value Mean?

Together we will work through various examples of how to create a hypothesis test about population means using normal distributions and t-distributions.

One Sample T Test – Lesson & Examples (Video)

  • Introduction to Video: One Sample t-test
  • 00:00:43 – Steps for conducting a hypothesis test for population means (one sample z-test or one sample t-test)
  • Exclusive Content for Members Only
  • 00:03:49 – Conduct a hypothesis test and confidence interval when population standard deviation is known (Example #1)
  • 00:13:49 – Test the null hypothesis when population standard deviation is known (Example #2)
  • 00:18:56 – Use a one-sample t-test to test a claim (Example #3)
  • 00:26:50 – Conduct a hypothesis test and confidence interval when population standard deviation is unknown (Example #4)
  • 00:37:16 – Conduct a hypothesis test by using a one-sample t-test and provide a confidence interval (Example #5)
  • 00:49:19 – Test the hypothesis by first finding the sample mean and standard deviation (Example #6)
  • Practice Problems with Step-by-Step Solutions
  • Chapter Tests with Video Solutions

Get access to all the courses and over 450 HD videos with your subscription

Monthly and Yearly Plans Available

Get My Subscription Now

Still wondering if CalcWorkshop is right for you? Take a Tour and find out how a membership can take the struggle out of learning math.

5 Star Excellence award from Shopper Approved for collecting at least 100 5 star reviews

T-test Formula

The t-test formula helps us to compare the average values of two data sets and determine if they belong to the same population or are they different. The t-score is compared with the critical value obtained from the t-table. The large t-score indicates that the groups are different and a small t-score indicates that the groups are similar.

What Is the T-test Formula?

The t-test formula is applied to the sample population. The t-test formula depends on the mean , variance, and  standard deviation of the data being compared. There are 3 types of t-tests that could be performed on the n number of samples collected.

  • One-sample test,
  • Independent sample t-test and
  • Paired samples t-test

The critical value is obtained from the t-table looking for the degree of freedom(df = n-1) and the corresponding α value(usually 0.05 or 0.1). If the t-test obtained statistically > CV then the initial hypothesis is wrong and we conclude that the results are significantly different.

One-Sample T-Test Formula

For comparing the mean of a population \(\overline{x}\) from n samples, with a specified theoretical mean μ, we use a one-sample t-test.

\(t= \dfrac{\overline{x}- μ}{\dfrac{\sigma}{\sqrt{n}}}\)

where σ/√n is the standard error

t-test formula for one-sample test

Independent Sample T-Test

Students t-test is used to compare the mean of two groups of samples. It helps evaluate if the means of the two sets of data are statistically significantly different from each other.

\(t = \dfrac{\overline{x_{1}}-\overline{x_{2}}}{\sqrt{(\dfrac{s_{1}^2}{n_{1}}+\dfrac{s_{2}^2}{{n_{2}}}})}\)

t-test formula

t = Student's t-test

  • \(x_{1}\) = mean of first group
  • \(x_{2}\)= mean of second group
  • \(s_{1}\) = standard deviation of group 1
  • \(s_{2}\) = standard deviation of group 1
  • \(n_{1}\)= number of observations in group 1
  • \(n_{2}\)= number of observations in group 2

Paired Samples T-Test

Whenever two distributions of the variables are highly correlated, they could be pre and post test results from the same people. In such cases, we use the paired samples t-test.

\(t = \dfrac{Σ(x_{1}-x_{2})}{\dfrac{s}{\sqrt{n}}}\)

\(x_{1}-x_{2}\) = Difference mean of the pairs

s= standard deviation

n = sample size

hypothesis testing with t test examples

Book a Free Trial Class

Examples Using t-test Formula

Example 1: Calculate a t-test for the following data of the number of times people prefer coffee or tea in five time intervals.

Coffee Tea
4 3
5 8
7 6
6 4
9 7

Solution: let \(x_{1}\) be the sample of data that prefers coffee and \(x_{2}\) be the sample of data that prefers tea.

let us find the mean, variance and the SD

\(x_{1}\) (\(x_{1}-\overline{x_{1}})\) (\(x_{1}-\overline{x_{1}})^2\) \(x_{2}\) (\(x_{2}-\overline{x_{2}})\) (\(x_{2}-\overline{x_{2}})^2\)
4 -2.2 4.84 3 -2.6 6.76
5 -1.2 1.44 8 2.4 5.76
7 0.8 0.64 6 0.4 0.16
6 -0.2 0.04 4 -1.6 2.56
9 2.8 7.84 7 1.4 1.96
   

\(\overline{x_{1}}\) = 31/ 5 = 6.2

\(\overline{x_{2}}\) = 28/5 = 5.6

Σ(x 1 -\(\overline{x_{1}}\)) 2 = 14.8

Σ(x 2 -\(\overline{x_{2}}\)) 2 = 17.2

S 1= 14.8/4 = 3.7

S 2 = 17.2/4 = 4.3

According to the t-test formula,

Applying the known values in the t-test formula, we get

\(t = \dfrac{6.2-5.6}{\sqrt{(\dfrac{3.7}{5}+\dfrac{4.3}{5})}}\)

\(=\dfrac{0.6}{\sqrt{1.6}}\)= 0.6/1.26 = 0.47

Example 2: A company wants to improve its sales. The previous sales data indicated that the average sale of 25 salesmen was $50 per transaction. After training, the recent data showed an average sale of $80 per transaction. If the standard deviation is $15, find the t-score. Has the training provided improved the sales?

\(H_{0}\)accepted hypothesis:the population mean = the claimed value⇒ μ = μ 0

\(H_{0}\)alternate hypothesis: the population mean not equal to the claimed value⇒ μ ≠ μ 0

t - test formula for independent test is \(t= \dfrac{m- μ}{\dfrac{s}{\sqrt{n}}}\)

Mean sale = 80, μ = 50, s= 15 and n= 25

substituting the values, we get t= (80-50)/(15/√25)

t = (30 ×5)/10 = 10

looking at the t-table we find 10 > 1.711 . (I.e. CV for α = 0.05). ∴ the accepted hypothesis is not true. Thus we conclude that the training boosted the sales.

Example 3: A pre-test and post-test conducted during a survey to find the study hours of Patrick on weekends. Calculate the t-score and determine (for α = 0.25) if the pre-test and post-test surveys are significantly different?

Pre-test(X) Post-test(Y) X-Y (X-Y)
1 2 -1 1
2 4 -2 4

According to the t-test formula, we know that \(t = \dfrac{ΣX-Y}{\dfrac{s}{\sqrt{n}}}\)

Σ(X-Y)= -3 = 3

s= Σ(X-Y) 2 /(n-1) = 5 2 /1 = 25

t= 3/(25/2) = 6/25 = 0.24

here degree of freedom is n-1 = 2-1 =1 and the corresponidng critical value in the t-table for α= 0.25, is 1.

Therefore the scores are not significantly different.

FAQs on T-test Formula

How do you calculate the t-test.

The following steps are followed to calculate the t-test.

  • Get the data. Find the mean.
  • Subtract the mean score from each individual score
  • Square the differences.
  • Add up all the squared differences.
  • Find the variance and standard deviation.
  • Key-in the values in the formula: \(t = \dfrac{Σx_{1}- mean}{\dfrac{s}{\sqrt{n}}}\)

What is the Formula for Finding The Independent T-test?

Students t-test is used to compare the mean of two groups of samples.

t = Student's t-test score

\(x_{1}\) = mean of first group and \(x_{2}\)= mean of second group

\(s_{1}\) = standard deviation of group 1 and \(s_{2}\) = standard deviation of group 1

\(n_{1}\)= number of observations in group 1 and \(n_{2}\)= number of observations in group 2

What is a One-Sample t-test?

The one-sample t-test is the statistical test used to determine whether an unknown population mean is different from a specific value. For example, comparing the mean height of the students with respect to the national average height of an adult.

What is a T-test Formula Used For?

We use the T-test Formula to statistically determine if there is a significant difference between the means of two groups that are related in certain aspects. Examples: a gym center tests the weight loss from a few samples, a company hiring candidates is set to determine the skills of 2 candidates from two different universities at the interview, and so on.

If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

To log in and use all the features of Khan Academy, please enable JavaScript in your browser.

AP®︎/College Statistics

Course: ap®︎/college statistics   >   unit 11.

  • Hypotheses for a two-sample t test

Example of hypotheses for paired and two-sample t tests

  • Writing hypotheses to test the difference of means
  • Two-sample t test for difference of means
  • Test statistic in a two-sample t test
  • P-value in a two-sample t test
  • Conclusion for a two-sample t test using a P-value
  • Conclusion for a two-sample t test using a confidence interval
  • Making conclusions about the difference of means

hypothesis testing with t test examples

Want to join the conversation?

  • Upvote Button navigates to signup page
  • Downvote Button navigates to signup page
  • Flag Button navigates to signup page

Video transcript

Pardon Our Interruption

As you were browsing something about your browser made us think you were a bot. There are a few reasons this might happen:

  • You've disabled JavaScript in your web browser.
  • You're a power user moving through this website with super-human speed.
  • You've disabled cookies in your web browser.
  • A third-party browser plugin, such as Ghostery or NoScript, is preventing JavaScript from running. Additional information is available in this support article .

To regain access, please make sure that cookies and JavaScript are enabled before reloading the page.

  • Recommended

hypothesis testing with t test examples

How physicians can fix media bias with science

The assassination attempt is the straw that breaks the camel’s back. The “gaslighting” is over. The rules for truth by legacy media are never examined for objectivity. We do not have the Inquisition in the United States; we have the legacy media.

One “fact-checker” measures truth by “Pinocchios.” There is a better way—hypothesis testing. Who better to know about hypothesis testing than a physician?

What if the facts about how Medicare is represented by two media outlets are tested? Hypothesis testing follows four rules:

1. Identify the truth: The truth is out there. Truth-telling has nine phases, each representing a specific duty that pertains to an ideal storyteller.

  • The initiation phase: The duty to collect all the facts.
  • The acceptance phase: The duty to accept a fact verifiable by objective evidence.
  • The rejection phase: The duty to reject an artifact not verifiable by objective evidence.
  • The attribution phase: The duty to source the facts.
  • The external review phase: The duty to examine the motives of others to influence facts.
  • The internal review phase: The duty to examine a personal motive to influence facts.
  • The discrimination phase: The duty to distinguish an opinion from a fact. Opinions, even a consensus by authorities, are not facts.
  • The equanimity phase: The duty not to contaminate a fact with emotion.
  • The analysis phase: The duty to use facts, and only facts, to arrive at a conclusion.

2. State the subject matter: It is the actual storyteller’s version of reality. The subject matter contains the same facts, but some may be subtly misrepresented, just enough to satisfy the conclusion. The subject matter is divided into the same nine phases as they pertain to the actual storyteller.

3. The Test: Each phase of the subject matter is compared to its counterpart in the truth. The comparison measures the “relative risk” resulting from the misrepresentation of a fact by the actual storyteller.

  • If there is no difference, the relative risk equals 1.0.
  • If there is a difference, the relative risk is greater than 1.0. A relative risk greater than 1.0 is a Risk of Bias. For the sake of transparency, the assignments of Risk of Bias are documented for anyone to see and, if need be, to dispute.

A single sample of nine relative risks emerges representing each phase in the subject matter. Some are 1.0, and some are greater than 1.0. Because storytellers naturally tend to exaggerate a fact, producing a relative risk greater than 1.0, this discrepancy itself is not proof of a departure from the truth. Bias is intentional. For proof, the collective difference among the nine relative risks in all phases of the subject matter must be statistically significant.

4. Analysis: To determine a statistically significant difference, the sample is analyzed using the single-sample T-test, found in any statistical software. The level of significance, or alpha, is 0.05, which corresponds to 95 percent confidence. The population mean, or mu, is 1.0, which corresponds to the truth. The result is the p-value.

  • If the p-value is equal to or greater than 0.05, there is no statistically significant difference between the subject matter and the truth. Although there may be a phase that contains an exaggeration, the risk of bias is not sufficient for it to misrepresent reality. Therefore, there is no bias. This is the null hypothesis. If the null hypothesis is retained, the subject matter is the null hypothesis.
  • If the p-value is less than 0.05, there is a statistically significant difference. Therefore, there is quantifiable proof of bias. This is the alternate hypothesis. The alternate hypothesis is accepted by default. If the null hypothesis is rejected, the subject matter is the alternate hypothesis.

Hypothesis testing, unlike “Pinocchios,” objectively makes a valid comparison between truth and facsimile. A Pinocchio, while quantitative, has no level of confidence. However, a p-value has a level of confidence of 95 percent. For a rational person, 95 percent confidence stands in stark contrast to a Pinocchio.

As an example of hypothesis testing, the truth consists of the verifiable facts about Medicare that are publicly available in government documents. The subject matter consists of two media outlets’ versions of the truth.

One storyteller is Fox News. The sample is 1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 2.0, 1.0, and the p-value is 0.051893. The collective risk of bias is not sufficient to misrepresent reality.

The other storyteller is MSNBC. The sample is 1.5, 1.5, 1.5, 2.0, 1.5, 1.5, 1.5, 2.0, 2.0, and the p-value is 0.000022. The collective risk of bias is sufficient to misrepresent reality.

The difference between the two p-values shows that MSNBC’s version of Medicare is 99.9 percent less reliable than Fox’s version.

Howard Smith  is an obstetrics-gynecology physician.

hypothesis testing with t test examples

Why I won't let my wife see her EOBs anymore

hypothesis testing with t test examples

Tagged as: Mainstream media

More by Howard Smith, MD

hypothesis testing with t test examples

The truth about medical lawsuits: What the numbers reveal

The flaw with medical malpractice litigation, why most medical malpractice claims never see a courtroom, related posts.

hypothesis testing with t test examples

Social media: Striking a balance for physicians and parents

hypothesis testing with t test examples

I was trolled by another physician on social media. I am happy I did not respond.

hypothesis testing with t test examples

Are negative news cycles and social media injurious to our health?

hypothesis testing with t test examples

How I used social media to get promoted to professor

hypothesis testing with t test examples

Sharing mental health issues on social media

hypothesis testing with t test examples

How physicians can engage on social media

More in physician.

hypothesis testing with t test examples

Why I won’t let my wife see her EOBs anymore

hypothesis testing with t test examples

Caring for our caregivers: Addressing the burnout crisis in health care

hypothesis testing with t test examples

A doctor’s eye-opening journey as a patient

hypothesis testing with t test examples

The rise of at-home medical tests: Can the hype meet our health care needs?

hypothesis testing with t test examples

Why curing baldness remains as elusive as putting a man on the moon

hypothesis testing with t test examples

A night of stars: Finding solace in the vastness of the sea

Most popular.

hypothesis testing with t test examples

The truth behind opioid use disorder

hypothesis testing with t test examples

From conviction to appeal: a doctor’s opioid case sparks debate

hypothesis testing with t test examples

Stop physician burnout: the hidden danger of AI note-writing software

hypothesis testing with t test examples

The heartbreaking decision that taught me the power of boundaries

Past 6 months.

hypothesis testing with t test examples

Struggles of navigating prestigious medical systems

hypothesis testing with t test examples

The unseen dangers of faulty expert witness testimony

hypothesis testing with t test examples

Palliative care is plagued by misunderstanding

hypothesis testing with t test examples

The sham peer review: a hidden contributor to the doctor shortage

hypothesis testing with t test examples

Quiet firing in medicine: my journey from burnout to freedom

Recent posts.

hypothesis testing with t test examples

Access to uterine artery embolization for all women [PODCAST]

hypothesis testing with t test examples

The hidden heroes who fought for women’s reproductive rights in the 1950s

hypothesis testing with t test examples

Unmasking online scams: How to stay safe as a visible patient advocate

Subscribe to kevinmd and never miss a story.

Get free updates delivered free to your inbox.

hypothesis testing with t test examples

Find jobs at Careers by KevinMD.com

Search thousands of physician, PA, NP, and CRNA jobs now.

dc-ftr

CME Spotlights

hypothesis testing with t test examples

Leave a Comment

Comments are moderated before they are published. Please read the comment policy .

hypothesis testing with t test examples

  • Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar

Statistics By Jim

Making statistics intuitive

One-Tailed and Two-Tailed Hypothesis Tests Explained

By Jim Frost 60 Comments

Choosing whether to perform a one-tailed or a two-tailed hypothesis test is one of the methodology decisions you might need to make for your statistical analysis. This choice can have critical implications for the types of effects it can detect, the statistical power of the test, and potential errors.

In this post, you’ll learn about the differences between one-tailed and two-tailed hypothesis tests and their advantages and disadvantages. I include examples of both types of statistical tests. In my next post, I cover the decision between one and two-tailed tests in more detail.

What Are Tails in a Hypothesis Test?

First, we need to cover some background material to understand the tails in a test. Typically, hypothesis tests take all of the sample data and convert it to a single value, which is known as a test statistic. You’re probably already familiar with some test statistics. For example, t-tests calculate t-values . F-tests, such as ANOVA, generate F-values . The chi-square test of independence and some distribution tests produce chi-square values. All of these values are test statistics. For more information, read my post about Test Statistics .

These test statistics follow a sampling distribution. Probability distribution plots display the probabilities of obtaining test statistic values when the null hypothesis is correct. On a probability distribution plot, the portion of the shaded area under the curve represents the probability that a value will fall within that range.

The graph below displays a sampling distribution for t-values. The two shaded regions cover the two-tails of the distribution.

Plot that display critical regions in the two tails of the distribution.

Keep in mind that this t-distribution assumes that the null hypothesis is correct for the population. Consequently, the peak (most likely value) of the distribution occurs at t=0, which represents the null hypothesis in a t-test. Typically, the null hypothesis states that there is no effect. As t-values move further away from zero, it represents larger effect sizes. When the null hypothesis is true for the population, obtaining samples that exhibit a large apparent effect becomes less likely, which is why the probabilities taper off for t-values further from zero.

Related posts : How t-Tests Work and Understanding Probability Distributions

Critical Regions in a Hypothesis Test

In hypothesis tests, critical regions are ranges of the distributions where the values represent statistically significant results. Analysts define the size and location of the critical regions by specifying both the significance level (alpha) and whether the test is one-tailed or two-tailed.

Consider the following two facts:

  • The significance level is the probability of rejecting a null hypothesis that is correct.
  • The sampling distribution for a test statistic assumes that the null hypothesis is correct.

Consequently, to represent the critical regions on the distribution for a test statistic, you merely shade the appropriate percentage of the distribution. For the common significance level of 0.05, you shade 5% of the distribution.

Related posts : Significance Levels and P-values and T-Distribution Table of Critical Values

Two-Tailed Hypothesis Tests

Two-tailed hypothesis tests are also known as nondirectional and two-sided tests because you can test for effects in both directions. When you perform a two-tailed test, you split the significance level percentage between both tails of the distribution. In the example below, I use an alpha of 5% and the distribution has two shaded regions of 2.5% (2 * 2.5% = 5%).

When a test statistic falls in either critical region, your sample data are sufficiently incompatible with the null hypothesis that you can reject it for the population.

In a two-tailed test, the generic null and alternative hypotheses are the following:

  • Null : The effect equals zero.
  • Alternative :  The effect does not equal zero.

The specifics of the hypotheses depend on the type of test you perform because you might be assessing means, proportions, or rates.

Example of a two-tailed 1-sample t-test

Suppose we perform a two-sided 1-sample t-test where we compare the mean strength (4.1) of parts from a supplier to a target value (5). We use a two-tailed test because we care whether the mean is greater than or less than the target value.

To interpret the results, simply compare the p-value to your significance level. If the p-value is less than the significance level, you know that the test statistic fell into one of the critical regions, but which one? Just look at the estimated effect. In the output below, the t-value is negative, so we know that the test statistic fell in the critical region in the left tail of the distribution, indicating the mean is less than the target value. Now we know this difference is statistically significant.

Statistical output from a two-tailed 1-sample t-test.

We can conclude that the population mean for part strength is less than the target value. However, the test had the capacity to detect a positive difference as well. You can also assess the confidence interval. With a two-tailed hypothesis test, you’ll obtain a two-sided confidence interval. The confidence interval tells us that the population mean is likely to fall between 3.372 and 4.828. This range excludes the target value (5), which is another indicator of significance.

Advantages of two-tailed hypothesis tests

You can detect both positive and negative effects. Two-tailed tests are standard in scientific research where discovering any type of effect is usually of interest to researchers.

One-Tailed Hypothesis Tests

One-tailed hypothesis tests are also known as directional and one-sided tests because you can test for effects in only one direction. When you perform a one-tailed test, the entire significance level percentage goes into the extreme end of one tail of the distribution.

In the examples below, I use an alpha of 5%. Each distribution has one shaded region of 5%. When you perform a one-tailed test, you must determine whether the critical region is in the left tail or the right tail. The test can detect an effect only in the direction that has the critical region. It has absolutely no capacity to detect an effect in the other direction.

In a one-tailed test, you have two options for the null and alternative hypotheses, which corresponds to where you place the critical region.

You can choose either of the following sets of generic hypotheses:

  • Null : The effect is less than or equal to zero.
  • Alternative : The effect is greater than zero.

Plot that displays a single critical region for a one-tailed test.

  • Null : The effect is greater than or equal to zero.
  • Alternative : The effect is less than zero.

Plot that displays a single critical region in the left tail for a one-tailed test.

Again, the specifics of the hypotheses depend on the type of test you perform.

Notice how for both possible null hypotheses the tests can’t distinguish between zero and an effect in a particular direction. For example, in the example directly above, the null combines “the effect is greater than or equal to zero” into a single category. That test can’t differentiate between zero and greater than zero.

Example of a one-tailed 1-sample t-test

Suppose we perform a one-tailed 1-sample t-test. We’ll use a similar scenario as before where we compare the mean strength of parts from a supplier (102) to a target value (100). Imagine that we are considering a new parts supplier. We will use them only if the mean strength of their parts is greater than our target value. There is no need for us to differentiate between whether their parts are equally strong or less strong than the target value—either way we’d just stick with our current supplier.

Consequently, we’ll choose the alternative hypothesis that states the mean difference is greater than zero (Population mean – Target value > 0). The null hypothesis states that the difference between the population mean and target value is less than or equal to zero.

Statistical output for a one-tailed 1-sample t-test.

To interpret the results, compare the p-value to your significance level. If the p-value is less than the significance level, you know that the test statistic fell into the critical region. For this study, the statistically significant result supports the notion that the population mean is greater than the target value of 100.

Confidence intervals for a one-tailed test are similarly one-sided. You’ll obtain either an upper bound or a lower bound. In this case, we get a lower bound, which indicates that the population mean is likely to be greater than or equal to 100.631. There is no upper limit to this range.

A lower-bound matches our goal of determining whether the new parts are stronger than our target value. The fact that the lower bound (100.631) is higher than the target value (100) indicates that these results are statistically significant.

This test is unable to detect a negative difference even when the sample mean represents a very negative effect.

Advantages and disadvantages of one-tailed hypothesis tests

One-tailed tests have more statistical power to detect an effect in one direction than a two-tailed test with the same design and significance level. One-tailed tests occur most frequently for studies where one of the following is true:

  • Effects can exist in only one direction.
  • Effects can exist in both directions but the researchers only care about an effect in one direction. There is no drawback to failing to detect an effect in the other direction. (Not recommended.)

The disadvantage of one-tailed tests is that they have no statistical power to detect an effect in the other direction.

As part of your pre-study planning process, determine whether you’ll use the one- or two-tailed version of a hypothesis test. To learn more about this planning process, read 5 Steps for Conducting Scientific Studies with Statistical Analyses .

This post explains the differences between one-tailed and two-tailed statistical hypothesis tests. How these forms of hypothesis tests function is clear and based on mathematics. However, there is some debate about when you can use one-tailed tests. My next post explores this decision in much more depth and explains the different schools of thought and my opinion on the matter— When Can I Use One-Tailed Hypothesis Tests .

If you’re learning about hypothesis testing and like the approach I use in my blog, check out my Hypothesis Testing book! You can find it at Amazon and other retailers.

Cover image of my Hypothesis Testing: An Intuitive Guide ebook.

Share this:

hypothesis testing with t test examples

Reader Interactions

' src=

June 26, 2022 at 12:14 pm

Hi, Can help me with figuring out the null and alternative hypothesis of the following statement? Some claimed that the real average expenditure on beverage by general people is at least $10.

' src=

February 19, 2022 at 6:02 am

thank you for the thoroughly explanation, I’m still strugling to wrap my mind around the t-table and the relation between the alpha values for one or two tail probability and the confidence levels on the bottom (I’m understanding it so wrongly that for me it should be the oposite, like one tail 0,05 should correspond 95% CI and two tailed 0,025 should correspond to 95% because then you got the 2,5% on each side). In my mind if I picture the one tail diagram with an alpha of 0,05 I see the rest 95% inside the diagram, but for a one tail I only see 90% CI paired with a 5% alpha… where did the other 5% go? I tried to understand when you said we should just double the alpha for a one tail probability in order to find the CI but I still cant picture it. I have been trying to understand this. Like if you only have one tail and there is 0,05, shouldn’t the rest be on the other side? why is it then 90%… I know I’m missing a point and I can’t figure it out and it’s so frustrating…

' src=

February 23, 2022 at 10:01 pm

The alpha is the total shaded area. So, if the alpha = 0.05, you know that 5% of the distribution is shaded. The number of tails tells you how to divide the shaded areas. Is it all in one region (1-tailed) or do you split the shaded regions in two (2-tailed)?

So, for a one-tailed test with an alpha of 0.05, the 5% shading is all in one tail. If alpha = 0.10, then it’s 10% on one side. If it’s two-tailed, then you need to split that 10% into two–5% in both tails. Hence, the 5% in a one-tailed test is the same as a two-tailed test with an alpha of 0.10 because that test has the same 5% on one side (but there’s another 5% in the other tail).

It’s similar for CIs. However, for CIs, you shade the middle rather than the extremities. I write about that in one my articles about hypothesis testing and confidence intervals .

I’m not sure if I’m answering your question or not.

' src=

February 17, 2022 at 1:46 pm

I ran a post hoc Dunnett’s test alpha=0.05 after a significant Anova test in Proc Mixed using SAS. I want to determine if the means for treatment (t1, t2, t3) is significantly less than the means for control (p=pathogen). The code for the dunnett’s test is – LSmeans trt / diff=controll (‘P’) adjust=dunnett CL plot=control; I think the lower bound one tailed test is the correct test to run but I’m not 100% sure. I’m finding conflicting information online. In the output table for the dunnett’s test the mean difference between the control and the treatments is t1=9.8, t2=64.2, and t3=56.5. The control mean estimate is 90.5. The adjusted p-value by treatment is t1(p=0.5734), t2 (p=.0154) and t3(p=.0245). The adjusted lower bound confidence limit in order from t1-t3 is -38.8, 13.4, and 7.9. The adjusted upper bound for all test is infinity. The graphical output for the dunnett’s test in SAS is difficult to understand for those of us who are beginner SAS users. All treatments appear as a vertical line below the the horizontal line for control at 90.5 with t2 and t3 in the shaded area. For treatment 1 the shaded area is above the line for control. Looking at just the output table I would say that t2 and t3 are significantly lower than the control. I guess I would like to know if my interpretation of the outputs is correct that treatments 2 and 3 are statistically significantly lower than the control? Should I have used an upper bound one tailed test instead?

' src=

November 10, 2021 at 1:00 am

Thanks Jim. Please help me understand how a two tailed testing can be used to minimize errors in research

' src=

July 1, 2021 at 9:19 am

Hi Jim, Thanks for posting such a thorough and well-written explanation. It was extremely useful to clear up some doubts.

' src=

May 7, 2021 at 4:27 pm

Hi Jim, I followed your instructions for the Excel add-in. Thank you. I am very new to statistics and sort of enjoy it as I enter week number two in my class. I am to select if three scenarios call for a one or two-tailed test is required and why. The problem is stated:

30% of mole biopsies are unnecessary. Last month at his clinic, 210 out of 634 had benign biopsy results. Is there enough evidence to reject the dermatologist’s claim?

Part two, the wording changes to “more than of 30% of biopsies,” and part three, the wording changes to “less than 30% of biopsies…”

I am not asking for the problem to be solved for me, but I cannot seem to find direction needed. I know the elements i am dealing with are =30%, greater than 30%, and less than 30%. 210 and 634. I just don’t know what to with the information. I can’t seem to find an example of a similar problem to work with.

May 9, 2021 at 9:22 pm

As I detail in this post, a two-tailed test tells you whether an effect exists in either direction. Or, is it different from the null value in either direction. For the first example, the wording suggests you’d need a two-tailed test to determine whether the population proportion is ≠ 30%. Whenever you just need to know ≠, it suggests a two-tailed test because you’re covering both directions.

For part two, because it’s in one direction (greater than), you need a one-tailed test. Same for part three but it’s less than. Look in this blog post to see how you’d construct the null and alternative hypotheses for these cases. Note that you’re working with a proportion rather than the mean, but the principles are the same! Just plug your scenario and the concept of proportion into the wording I use for the hypotheses.

I hope that helps!

' src=

April 11, 2021 at 9:30 am

Hello Jim, great website! I am using a statistics program (SPSS) that does NOT compute one-tailed t-tests. I am trying to compare two independent groups and have justifiable reasons why I only care about one direction. Can I do the following? Use SPSS for two-tailed tests to calculate the t & p values. Then report the p-value as p/2 when it is in the predicted direction (e.g , SPSS says p = .04, so I report p = .02), and report the p-value as 1 – (p/2) when it is in the opposite direction (e.g., SPSS says p = .04, so I report p = .98)? If that is incorrect, what do you suggest (hopefully besides changing statistics programs)? Also, if I want to report confidence intervals, I realize that I would only have an upper or lower bound, but can I use the CI’s from SPSS to compute that? Thank you very much!

April 11, 2021 at 5:42 pm

Yes, for p-values, that’s absolutely correct for both cases.

For confidence intervals, if you take one endpoint of a two-side CI, it becomes a one-side bound with half the confidence level.

Consequently, to obtain a one-sided bound with your desired confidence level, you need to take your desired significance level (e.g., 0.05) and double it. Then subtract it from 1. So, if you’re using a significance level of 0.05, double that to 0.10 and then subtract from 1 (1 – 0.10 = 0.90). 90% is the confidence level you want to use for a two-sided test. After obtaining the two-sided CI, use one of the endpoints depending on the direction of your hypothesis (i.e., upper or lower bound). That’s produces the one-sided the bound with the confidence level that you want. For our example, we calculated a 95% one-sided bound.

' src=

March 3, 2021 at 8:27 am

Hi Jim. I used the one-tailed(right) statistical test to determine an anomaly in the below problem statement: On a daily basis, I calculate the (mapped_%) in a common field between two tables.

The way I used the t-test is: On any particular day, I calculate the sample_mean, S.D and sample_count (n=30) for the last 30 days including the current day. My null hypothesis, H0 (pop. mean)=95 and H1>95 (alternate hypothesis). So, I calculate the t-stat based on the sample_mean, pop.mean, sample S.D and n. I then choose the t-crit value for 0.05 from my t-ditribution table for dof(n-1). On the current day if my abs.(t-stat)>t-crit, then I reject the null hypothesis and I say the mapped_pct on that day has passed the t-test.

I get some weird results here, where if my mapped_pct is as low as 6%-8% in all the past 30 days, the t-test still gets a “pass” result. Could you help on this? If my hypothesis needs to be changed.

I would basically look for the mapped_pct >95, if it worked on a static trigger. How can I use the t-test effectively in this problem statement?

' src=

December 18, 2020 at 8:23 pm

Hello Dr. Jim, I am wondering if there is evidence in one of your books or other source you could provide, which supports that it is OK not to divide alpha level by 2 in one-tailed hypotheses. I need the source for supporting evidence in a Portfolio exercise and couldn’t find one.

I am grateful for your reply and for your statistics knowledge sharing!

' src=

November 27, 2020 at 10:31 pm

If I did a one directional F test ANOVA(one tail ) and wanted to calculate a confidence interval for each individual groups (3) mean . Would I use a one tailed or two tailed t , within my confidence interval .

November 29, 2020 at 2:36 am

Hi Bashiru,

F-tests for ANOVA will always be one-tailed for the reasons I discuss in this post. To learn more about, read my post about F-tests in ANOVA .

For the differences between my groups, I would not use t-tests because the family-wise error rate quickly grows out of hand. To learn more about how to compare group means while controlling the familywise error rate, read my post about using post hoc tests with ANOVA . Typically, these are two-side intervals but you’d be able to use one-sided.

' src=

November 26, 2020 at 10:51 am

Hi Jim, I had a question about the formulation of the hypotheses. When you want to test if a beta = 1 or a beta = 0. What will be the null hypotheses? I’m having trouble with finding out. Because in most cases beta = 0 is the null hypotheses but in this case you want to test if beta = 0. so i’m having my doubts can it in this case be the alternative hypotheses or is it still the null hypotheses?

Kind regards, Noa

November 27, 2020 at 1:21 am

Typically, the null hypothesis represents no effect or no relationship. As an analyst, you’re hoping that your data have enough evidence to reject the null and favor the alternative.

Assuming you’re referring to beta as in regression coefficients, zero represents no relationship. Consequently, beta = 0 is the null hypothesis.

You might hope that beta = 1, but you don’t usually include that in your alternative hypotheses. The alternative hypothesis usually states that it does not equal no effect. In other words, there is an effect but it doesn’t state what it is.

There are some exceptions to the above but I’m writing about the standard case.

' src=

November 22, 2020 at 8:46 am

Your articles are a help to intro to econometrics students. Keep up the good work! More power to you!

' src=

November 6, 2020 at 11:25 pm

Hello Jim. Can you help me with these please?

Write the null and alternative hypothesis using a 1-tailed and 2-tailed test for each problem. (In paragraph and symbols)

A teacher wants to know if there is a significant difference in the performance in MAT C313 between her morning and afternoon classes.

It is known that in our university canteen, the average waiting time for a customer to receive and pay for his/her order is 20 minutes. Additional personnel has been added and now the management wants to know if the average waiting time had been reduced.

November 8, 2020 at 12:29 am

I cover how to write the hypotheses for the different types of tests in this post. So, you just need to figure which type of test you need to use. In your case, you want to determine whether the mean waiting time is less than the target value of 20 minutes. That’s a 1-sample t-test because you’re comparing a mean to a target value (20 minutes). You specifically want to determine whether the mean is less than the target value. So, that’s a one-tailed test. And, you’re looking for a mean that is “less than” the target.

So, go to the one-tailed section in the post and look for the hypotheses for the effect being less than. That’s the one with the critical region on the left side of the curve.

Now, you need include your own information. In your case, you’re comparing the sample estimate to a population mean of 20. The 20 minutes is your null hypothesis value. Use the symbol mu μ to represent the population mean.

You put all that together and you get the following:

Null: μ ≥ 20 Alternative: μ 0 to denote the null hypothesis and H 1 or H A to denote the alternative hypothesis if that’s what you been using in class.

' src=

October 17, 2020 at 12:11 pm

I was just wondering if you could please help with clarifying what the hypothesises would be for say income for gamblers and, age of gamblers. I am struggling to find which means would be compared.

October 17, 2020 at 7:05 pm

Those are both continuous variables, so you’d use either correlation or regression for them. For both of those analyses, the hypotheses are the following:

Null : The correlation or regression coefficient equals zero (i.e., there is no relationship between the variables) Alternative : The coefficient does not equal zero (i.e., there is a relationship between the variables.)

When the p-value is less than your significance level, you reject the null and conclude that a relationship exists.

' src=

October 17, 2020 at 3:05 am

I was ask to choose and justify the reason between a one tailed and two tailed test for dummy variables, how do I do that and what does it mean?

October 17, 2020 at 7:11 pm

I don’t have enough information to answer your question. A dummy variable is also known as an indicator variable, which is a binary variable that indicates the presence or absence of a condition or characteristic. If you’re using this variable in a hypothesis test, I’d presume that you’re using a proportions test, which is based on the binomial distribution for binary data.

Choosing between a one-tailed or two-tailed test depends on subject area issues and, possibly, your research objectives. Typically, use a two-tailed test unless you have a very good reason to use a one-tailed test. To understand when you might use a one-tailed test, read my post about when to use a one-tailed hypothesis test .

' src=

October 16, 2020 at 2:07 pm

In your one-tailed example, Minitab describes the hypotheses as “Test of mu = 100 vs > 100”. Any idea why Minitab says the null is “=” rather than “= or less than”? No ASCII character for it?

October 16, 2020 at 4:20 pm

I’m not entirely sure even though I used to work there! I know we had some discussions about how to represent that hypothesis but I don’t recall the exact reasoning. I suspect that it has to do with the conclusions that you can draw. Let’s focus on the failing to reject the null hypothesis. If the test statistic falls in that region (i.e., it is not significant), you fail to reject the null. In this case, all you know is that you have insufficient evidence to say it is different than 100. I’m pretty sure that’s why they use the equal sign because it might as well be one.

Mathematically, I think using ≤ is more accurate, which you can really see when you look at the distribution plots. That’s why I phrase the hypotheses using ≤ or ≥ as needed. However, in terms of the interpretation, the “less than” portion doesn’t really add anything of importance. You can conclude that its equal to 100 or greater than 100, but not less than 100.

' src=

October 15, 2020 at 5:46 am

Thank you so much for your timely feedback. It helps a lot

October 14, 2020 at 10:47 am

How can i use one tailed test at 5% alpha on this problem?

A manufacturer of cellular phone batteries claims that when fully charged, the mean life of his product lasts for 26 hours with a standard deviation of 5 hours. Mr X, a regular distributor, randomly picked and tested 35 of the batteries. His test showed that the average life of his sample is 25.5 hours. Is there a significant difference between the average life of all the manufacturer’s batteries and the average battery life of his sample?

October 14, 2020 at 8:22 pm

I don’t think you’d want to use a one-tailed test. The goal is to determine whether the sample is significantly different than the manufacturer’s population average. You’re not saying significantly greater than or less than, which would be a one-tailed test. As phrased, you want a two-tailed test because it can detect a difference in either direct.

It sounds like you need to use a 1-sample t-test to test the mean. During this test, enter 26 as the test mean. The procedure will tell you if the sample mean of 25.5 hours is a significantly different from that test mean. Similarly, you’d need a one variance test to determine whether the sample standard deviation is significantly different from the test value of 5 hours.

For both of these tests, compare the p-value to your alpha of 0.05. If the p-value is less than this value, your results are statistically significant.

' src=

September 22, 2020 at 4:16 am

Hi Jim, I didn’t get an idea that when to use two tail test and one tail test. Will you please explain?

September 22, 2020 at 10:05 pm

I have a complete article dedicated to that: When Can I Use One-Tailed Tests .

Basically, start with the assumption that you’ll use a two-tailed test but then consider scenarios where a one-tailed test can be appropriate. I talk about all of that in the article.

If you have questions after reading that, please don’t hesitate to ask!

' src=

July 31, 2020 at 12:33 pm

Thank you so so much for this webpage.

I have two scenarios that I need some clarification. I will really appreciate it if you can take a look:

So I have several of materials that I know when they are tested after production. My hypothesis is that the earlier they are tested after production, the higher the mean value I should expect. At the same time, the later they are tested after production, the lower the mean value. Since this is more like a “greater or lesser” situation, I should use one tail. Is that the correct approach?

On the other hand, I have several mix of materials that I don’t know when they are tested after production. I only know the mean values of the test. And I only want to know whether one mean value is truly higher or lower than the other, I guess I want to know if they are only significantly different. Should I use two tail for this? If they are not significantly different, I can judge based on the mean values of test alone. And if they are significantly different, then I will need to do other type of analysis. Also, when I get my P-value for two tail, should I compare it to 0.025 or 0.05 if my confidence level is 0.05?

Thank you so much again.

July 31, 2020 at 11:19 pm

For your first, if you absolutely know that the mean must be lower the later the material is tested, that it cannot be higher, that would be a situation where you can use a one-tailed test. However, if that’s not a certainty, you’re just guessing, use a two-tail test. If you’re measuring different items at the different times, use the independent 2-sample t-test. However, if you’re measuring the same items at two time points, use the paired t-test. If it’s appropriate, using the paired t-test will give you more statistical power because it accounts for the variability between items. For more information, see my post about when it’s ok to use a one-tailed test .

For the mix of materials, use a two-tailed test because the effect truly can go either direction.

Always compare the p-value to your full significance level regardless of whether it’s a one or two-tailed test. Don’t divide the significance level in half.

' src=

June 17, 2020 at 2:56 pm

Is it possible that we reach to opposite conclusions if we use a critical value method and p value method Secondly if we perform one tail test and use p vale method to conclude our Ho, then do we need to convert sig value of 2 tail into sig value of one tail. That can be done just by dividing it with 2

June 18, 2020 at 5:17 pm

The p-value method and critical value method will always agree as long as you’re not changing anything about how the methodology.

If you’re using statistical software, you don’t need to make any adjustments. The software will do that for you.

However, if you calculating it by hand, you’ll need to take your significance level and then look in the table for your test statistic for a one-tailed test. For example, you’ll want to look up 5% for a one-tailed test rather than a two-tailed test. That’s not as simple as dividing by two. In this article, I show examples of one-tailed and two-tailed tests for the same degrees of freedom. The t critical value for the two-tailed test is +/- 2.086 while for the one-sided test it is 1.725. It is true that probability associated with those critical values doubles for the one-tailed test (2.5% -> 5%), but the critical value itself is not half (2.086 -> 1.725). Study the first several graphs in this article to see why that is true.

For the p-value, you can take a two-tailed p-value and divide by 2 to determine the one-sided p-value. However, if you’re using statistical software, it does that for you.

' src=

June 11, 2020 at 3:46 pm

Hello Jim, if you have the time I’d be grateful if you could shed some clarity on this scenario:

“A researcher believes that aromatherapy can relieve stress but wants to determine whether it can also enhance focus. To test this, the researcher selected a random sample of students to take an exam in which the average score in the general population is 77. Prior to the exam, these students studied individually in a small library room where a lavender scent was present. If students in this group scored significantly above the average score in general population [is this one-tailed or two-tailed hypothesis?], then this was taken as evidence that the lavender scent enhanced focus.”

Thank you for your time if you do decide to respond.

June 11, 2020 at 4:00 pm

It’s unclear from the information provided whether the researchers used a one-tailed or two-tailed test. It could be either. A two-tailed test can detect effects in both directions, so it could definitely detect an average group score above the population score. However, you could also detect that effect using a one-tailed test if it was set up correctly. So, there’s not enough information in what you provided to know for sure. It could be either.

However, that’s irrelevant to answering the question. The tricky part, as I see it, is that you’re not entirely sure about why the scores are higher. Are they higher because the lavender scent increased concentration or are they higher because the subjects have lower stress from the lavender? Or, maybe it’s not even related to the scent but some other characteristic of the room or testing conditions in which they took the test. You just know the scores are higher but not necessarily why they’re higher.

I’d say that, no, it’s not necessarily evidence that the lavender scent enhanced focus. There are competing explanations for why the scores are higher. Also, it would be best do this as an experiment with a control and treatment group where subjects are randomly assigned to either group. That process helps establish causality rather than just correlation and helps rules out competing explanations for why the scores are higher.

By the way, I spend a lot of time on these issues in my Introduction to Statistics ebook .

' src=

June 9, 2020 at 1:47 pm

If a left tail test has an alpha value of 0.05 how will you find the value in the table

' src=

April 19, 2020 at 10:35 am

Hi Jim, My question is in regards to the results in the table in your example of the one-sample T (Two-Tailed) test. above. What about the P-value? The P-value listed is .018. I assuming that is compared to and alpha of 0.025, correct?

In regression analysis, when I get a test statistic for the predictive variable of -2.099 and a p-value of 0.039. Am I comparing the p-value to an alpha of 0.025 or 0.05? Now if I run a Bootstrap for coefficients analysis, the results say the sig (2-tail) is 0.098. What are the critical values and alpha in this case? I’m trying to reconcile what I am seeing in both tables.

Thanks for your help.

April 20, 2020 at 3:24 am

Hi Marvalisa,

For one-tailed tests, you don’t need to divide alpha in half. If you can tell your software to perform a one-tailed test, it’ll do all the calculations necessary so you don’t need to adjust anything. So, if you’re using an alpha of 0.05 for a one-tailed test and your p-value is 0.04, it is significant. The procedures adjust the p-values automatically and it all works out. So, whether you’re using a one-tailed or two-tailed test, you always compare the p-value to the alpha with no need to adjust anything. The procedure does that for you!

The exception would be if for some reason your software doesn’t allow you to specify that you want to use a one-tailed test instead of a two-tailed test. Then, you divide the p-value from a two-tailed test in half to get the p-value for a one tailed test. You’d still compare it to your original alpha.

For regression, the same thing applies. If you want to use a one-tailed test for a cofficient, just divide the p-value in half if you can’t tell the software that you want a one-tailed test. The default is two-tailed. If your software has the option for one-tailed tests for any procedure, including regression, it’ll adjust the p-value for you. So, in the normal course of things, you won’t need to adjust anything.

' src=

March 26, 2020 at 12:00 pm

Hey Jim, for a one-tailed hypothesis test with a .05 confidence level, should I use a 95% confidence interval or a 90% confidence interval? Thanks

March 26, 2020 at 5:05 pm

You should use a one-sided 95% confidence interval. One-sided CIs have either an upper OR lower bound but remains unbounded on the other side.

' src=

March 16, 2020 at 4:30 pm

This is not applicable to the subject but… When performing tests of equivalence, we look at the confidence interval of the difference between two groups, and we perform two one-sided t-tests for equivalence..

' src=

March 15, 2020 at 7:51 am

Thanks for this illustrative blogpost. I had a question on one of your points though.

By definition of H1 and H0, a two-sided alternate hypothesis is that there is a difference in means between the test and control. Not that anything is ‘better’ or ‘worse’.

Just because we observed a negative result in your example, does not mean we can conclude it’s necessarily worse, but instead just ‘different’.

Therefore while it enables us to spot the fact that there may be differences between test and control, we cannot make claims about directional effects. So I struggle to see why they actually need to be used instead of one-sided tests.

What’s your take on this?

March 16, 2020 at 3:02 am

Hi Dominic,

If you’ll notice, I carefully avoid stating better or worse because in a general sense you’re right. However, given the context of a specific experiment, you can conclude whether a negative value is better or worse. As always in statistics, you have to use your subject-area knowledge to help interpret the results. In some cases, a negative value is a bad result. In other cases, it’s not. Use your subject-area knowledge!

I’m not sure why you think that you can’t make claims about directional effects? Of course you can!

As for why you shouldn’t use one-tailed tests for most cases, read my post When Can I Use One-Tailed Tests . That should answer your questions.

' src=

May 10, 2019 at 12:36 pm

Your website is absolutely amazing Jim, you seem like the nicest guy for doing this and I like how there’s no ulterior motive, (I wasn’t automatically signed up for emails or anything when leaving this comment). I study economics and found econometrics really difficult at first, but your website explains it so clearly its been a big asset to my studies, keep up the good work!

May 10, 2019 at 2:12 pm

Thank you so much, Jack. Your kind words mean a lot!

' src=

April 26, 2019 at 5:05 am

Hy Jim I really need your help now pls

One-tailed and two- tailed hypothesis, is it the same or twice, half or unrelated pls

April 26, 2019 at 11:41 am

Hi Anthony,

I describe how the hypotheses are different in this post. You’ll find your answers.

' src=

February 8, 2019 at 8:00 am

Thank you for your blog Jim, I have a Statistics exam soon and your articles let me understand a lot!

February 8, 2019 at 10:52 am

You’re very welcome! I’m happy to hear that it’s been helpful. Best of luck on your exam!

' src=

January 12, 2019 at 7:06 am

Hi Jim, When you say target value is 5. Do you mean to say the population mean is 5 and we are trying to validate it with the help of sample mean 4.1 using Hypo tests ?.. If it is so.. How can we measure a population parameter as 5 when it is almost impossible o measure a population parameter. Please clarify

January 12, 2019 at 6:57 pm

When you set a target for a one-sample test, it’s based on a value that is important to you. It’s not a population parameter or anything like that. The example in this post uses a case where we need parts that are stronger on average than a value of 5. We derive the value of 5 by using our subject area knowledge about what is required for a situation. Given our product knowledge for the hypothetical example, we know it should be 5 or higher. So, we use that in the hypothesis test and determine whether the population mean is greater than that target value.

When you perform a one-sample test, a target value is optional. If you don’t supply a target value, you simply obtain a confidence interval for the range of values that the parameter is likely to fall within. But, sometimes there is meaningful number that you want to test for specifically.

I hope that clarifies the rational behind the target value!

' src=

November 15, 2018 at 8:08 am

I understand that in Psychology a one tailed hypothesis is preferred. Is that so

November 15, 2018 at 11:30 am

No, there’s no overall preference for one-tailed hypothesis tests in statistics. That would be a study-by-study decision based on the types of possible effects. For more information about this decision, read my post: When Can I Use One-Tailed Tests?

' src=

November 6, 2018 at 1:14 am

I’m grateful to you for the explanations on One tail and Two tail hypothesis test. This opens my knowledge horizon beyond what an average statistics textbook can offer. Please include more examples in future posts. Thanks

November 5, 2018 at 10:20 am

Thank you. I will search it as well.

Stan Alekman

November 4, 2018 at 8:48 pm

Jim, what is the difference between the central and non-central t-distributions w/respect to hypothesis testing?

November 5, 2018 at 10:12 am

Hi Stan, this is something I will need to look into. I know central t-distribution is the common Student t-distribution, but I don’t have experience using non-central t-distributions. There might well be a blog post in that–after I learn more!

' src=

November 4, 2018 at 7:42 pm

this is awesome.

Comments and Questions Cancel reply

IMAGES

  1. Hypothesis Testing Example Two Sample t-Test

    hypothesis testing with t test examples

  2. Hypothesis Testing:T Test

    hypothesis testing with t test examples

  3. Hypothesis Testing How To Perform Paired Sample T Tes

    hypothesis testing with t test examples

  4. T Test Example

    hypothesis testing with t test examples

  5. One Sample T Test

    hypothesis testing with t test examples

  6. t-test formula

    hypothesis testing with t test examples

COMMENTS

  1. T Test Overview: How to Use & Examples

    We'll use a two-sample t test to evaluate if the difference between the two group means is statistically significant. The t test output is below. In the output, you can see that the treatment group (Sample 1) has a mean of 109 while the control group's (Sample 2) average is 100. The p-value for the difference between the groups is 0.112.

  2. T-test and Hypothesis Testing (Explained Simply)

    Aug 5, 2022. 6. Photo by Andrew George on Unsplash. Student's t-tests are commonly used in inferential statistics for testing a hypothesis on the basis of a difference between sample means. However, people often misinterpret the results of t-tests, which leads to false research findings and a lack of reproducibility of studies.

  3. An Introduction to t Tests

    Revised on June 22, 2023. A t test is a statistical test that is used to compare the means of two groups. It is often used in hypothesis testing to determine whether a process or treatment actually has an effect on the population of interest, or whether two groups are different from one another. t test example.

  4. T Test (Student's T-Test): Definition and Examples

    The null hypothesis for the independent samples t-test is μ 1 = μ 2. So it assumes the means are equal. With the paired t test, the null hypothesis is that the pairwise difference between the two tests is equal (H 0: µ d = 0). Paired Samples T Test By hand. Example question: Calculate a paired t test by hand for the following data:

  5. Independent Samples T Test: Definition, Using & Interpreting

    Independent Samples T Tests Hypotheses. Independent samples t tests have the following hypotheses: Null hypothesis: The means for the two populations are equal. Alternative hypothesis: The means for the two populations are not equal.; If the p-value is less than your significance level (e.g., 0.05), you can reject the null hypothesis. The difference between the two means is statistically ...

  6. PDF Hypothesis Testing with t Tests

    Hypothesis Tests: Single-Sample tTests. Hypothesis test in which we compare data from one sample to a population for which we know the mean but not the standard deviation. Degrees of Freedom: The number of scores that are free to vary when estimating a population parameter from a sample df = N. 1 (for a Single-Sample.

  7. One Sample T Test: Definition, Using & Example

    One Sample T Test Hypotheses. A one sample t test has the following hypotheses: Null hypothesis (H 0): The population mean equals the hypothesized value (µ = H 0).; Alternative hypothesis (H A): The population mean does not equal the hypothesized value (µ ≠ H 0).; If the p-value is less than your significance level (e.g., 0.05), you can reject the null hypothesis.

  8. S.3.3 Hypothesis Testing Examples

    If the biologist set her significance level \(\alpha\) at 0.05 and used the critical value approach to conduct her hypothesis test, she would reject the null hypothesis if her test statistic t* were less than -1.6939 (determined using statistical software or a t-table):s-3-3. Since the biologist's test statistic, t* = -4.60, is less than -1.6939, the biologist rejects the null hypothesis.

  9. 6 Examples of Using T-Tests in Real Life

    Example 1: Fuel Treatment. Researchers want to know if a new fuel treatment leads to a change in the mean miles per gallon of a certain car. To test this, they conduct an experiment in which they measure the mpg of 11 cars with and without the fuel treatment. Since each car is used in each sample, the researchers can use a paired samples t-test ...

  10. t-Test

    The t-test is a statistical test procedure that tests whether there is a significant difference between the means of two groups. The two groups could be, ... In the one sample t-test, the null hypothesis and the alternative hypothesis are: Null hypothesis: The sample mean is equal to the given reference value (so there is no difference).

  11. Matched or Paired Samples T-Test

    This Statistics video tutorial provides a basic introduction into matched or paired samples. It explains how to use the T-test and the student's t-distribut...

  12. Hypotheses for a two-sample t test (video)

    If that's below your significance level, then you would reject your null hypothesis and it would suggest the alternative that might be that, "Hey, maybe this mean "is greater than zero." On the other hand, a two-sample T test is where you're thinking about two different populations. For example, you could be thinking about a population of men ...

  13. One Sample T-Test Hypothesis Test By Hand

    There is a paired data (also called correlated data) t-test that compares two samples from data that is related (like pretest score and post test score). t -test = (sample mean - population mean)/ [stddev/sqrt (n)] The sample mean "x" is 4.6 oz. The "mean" is the population mean of 4 oz. The sample std dev is .22 oz. n = 25.

  14. T Test Formula with Solved Examples

    The t-test is any statistical hypothesis test in which the test statistic follows a Student's t-distribution under the null hypothesis. It can be used to determine if two sets of data are significantly different from each other, and is most commonly applied when the test statistic would follow a normal distribution if the value of a scaling term in the test statistic were known.

  15. How t-Tests Work: 1-sample, 2-sample, and Paired t-Tests

    A paired t-test takes paired observations (like before and after), subtracts one from the other, and conducts a 1-sample t-test on the differences. Typically, a paired t-test determines whether the paired differences are significantly different from zero. Download the CSV data file to check this yourself: T-testData.

  16. Two Sample t-test: Definition, Formula, and Example

    Fortunately, a two sample t-test allows us to answer this question. Two Sample t-test: Formula. A two-sample t-test always uses the following null hypothesis: H 0: μ 1 = μ 2 (the two population means are equal) The alternative hypothesis can be either two-tailed, left-tailed, or right-tailed:

  17. Two-sample t test for difference of means

    Example of hypotheses for paired and two-sample t tests. Writing hypotheses to test the difference of means ... and conduct the two sample T test here, to see whether there's evidence that the sizes of tomato plants differ between the fields. ... that the mean of A is not equal to the mean of B, that they differ. And to do this two sample T ...

  18. One Sample T Test (Easily Explained w/ 5+ Examples!)

    00:13:49 - Test the null hypothesis when population standard deviation is known (Example #2) 00:18:56 - Use a one-sample t-test to test a claim (Example #3) 00:26:50 - Conduct a hypothesis test and confidence interval when population standard deviation is unknown (Example #4) 00:37:16 - Conduct a hypothesis test by using a one-sample t ...

  19. t-test formula

    The t-test formula is applied to the sample population. The t-test formula depends on the mean, variance, and standard deviation of the data being compared. There are 3 types of t-tests that could be performed on the n number of samples collected. One-sample test, Independent sample t-test and; Paired samples t-test

  20. Example of hypotheses for paired and two-sample t tests

    First of all, if you have two groups, one testing one placebo, then it's 2 samples. If it is the same group before and after, then paired t-test. I'm trying to run a dependent sample t-test/paired sample t test through using data from a Qualtrics survey measuring two groups of people (one with social anxiety and one without on the effects of ...

  21. 5 Free Resources for Understanding Hypothesis Testing

    The first video on hypothesis testing is available here. 4. Statistical Inference and Hypothesis Testing in Data Science Applications on Coursera. Coursera offers a range of free courses from colleges around the world. This one, created by the University of Colorado Boulder, is at the intermediate level and covers the fundamentals of hypothesis ...

  22. Hypothesis Testing: Uses, Steps & Example

    5 Steps of Significance Testing. Hypothesis testing involves five key steps, each critical to validating a research hypothesis using statistical methods: Formulate the Hypotheses: Write your research hypotheses as a null hypothesis (H 0) and an alternative hypothesis (H A ). Data Collection: Gather data specifically aimed at testing the ...

  23. A/B testing

    It includes application of statistical hypothesis testing or "two-sample hypothesis testing" as used in the field of statistics. A/B testing is a way to compare multiple versions of a single variable, for example by testing a subject's response to variant A against variant B, and determining which of the variants is more effective. [5]

  24. Chi-squared test

    Chi-squared distribution, showing χ 2 on the x-axis and p-value (right tail probability) on the y-axis.. A chi-squared test (also chi-square or χ 2 test) is a statistical hypothesis test used in the analysis of contingency tables when the sample sizes are large. In simpler terms, this test is primarily used to examine whether two categorical variables (two dimensions of the contingency table ...

  25. How t-Tests Work: t-Values, t-Distributions, and Probabilities

    Hypothesis tests work by taking the observed test statistic from a sample and using the sampling distribution to calculate the probability of obtaining that test statistic if the null hypothesis is correct. In the context of how t-tests work, you assess the likelihood of a t-value using the t-distribution.

  26. Hypothesis testing of the mean (docx)

    Statistics document from Gulu University, 6 pages, Hypothesis testing of the mean. In testing of mean, we test on the basis of a random sample if the mean of a population is the same as the hypothesized value or different. Application of the t-dsn. The following are some of the applications of the t-dsn:

  27. How physicians can fix media bias with science

    The article argues that traditional media's truth-telling is flawed and proposes hypothesis testing, a scientific method used by physicians, as a better way to measure truth, using Medicare reporting by Fox News and MSNBC as examples. ... To determine a statistically significant difference, the sample is analyzed using the single-sample T-test ...

  28. One-Tailed and Two-Tailed Hypothesis Tests Explained

    One-tailed hypothesis tests are also known as directional and one-sided tests because you can test for effects in only one direction. When you perform a one-tailed test, the entire significance level percentage goes into the extreme end of one tail of the distribution. In the examples below, I use an alpha of 5%.