t-test for a mean
Test a claim about a population mean and read off the test statistic and p-value, with the exact key presses for the TI-84 Plus CE, Casio fx-CG50, Casio fx-CG100 and TI-Nspire CX, plus what to write in the exam.
Open the calculator's one-sample t-test (T-Test, 1-SAMPLE t Test, 1-Sample t Test or t Test). Enter the hypothesised mean, either the data list or the sample mean, standard deviation s and sample size, and choose the alternative hypothesis that matches H1. Read the test statistic t and the p-value, then compare p with the significance level: if p is smaller, reject H0.
Example
A machine fills packets of sugar labelled 500 g. The masses, in grams, of a random sample of 8 packets are 496, 503, 492, 497, 494, 499, 493, 494. Assuming the masses are normally distributed, test at the 5% significance level whether the mean mass is different from 500 g.
State and . The calculator gives and with degrees of freedom. Since , reject : there is evidence at the 5% level that the mean mass is not 500 g (the sample mean is below it).
Choose your calculator
How to do a t-test for a mean on a TI-84 Plus CE
T-Test (from a list of data) | |
Press stat and choose 1:Edit. If L1 already has numbers in it, press ▲ to put the cursor on the name L1, then press clear and enter to empty the list. |
|
Type the data into L1, one value at a time, pressing enter after each: 496, 503, 492, 497, 494, 499, 493, 494. |
L1 496 503 492 497 494 499 493 494 |
Press stat, then ▶ ▶ to move past CALC to TESTS, and choose 2:T-Test. On the Inpt line the cursor should be on Data: press enter to select it. |
T-Test Inpt:Data Stats μ0: List: Freq:1 μ:≠μ0 <μ0 >μ0 Calculate Draw |
Move down with ▼ and fill in the lines. Type 5 0 0 for μ0, the mean in the null hypothesis. Set List to L1 (2nd 1) and leave Freq as 1. On the μ line move to the alternative hypothesis that matches your H1 (here ≠μ0) and press enter. |
T-Test Inpt:Data Stats μ0:500 List:L1 Freq:1 μ:≠μ0 <μ0 >μ0 Calculate Draw |
Move down to Calculate and press enter. The screen shows t, the p-value p, the sample mean x̄, the standard deviation Sx and the sample size n. The degrees of freedom are . and to 3 significant figures, with degrees of freedom. |
T-Test μ≠500 t=-3.12075799 p=.01682584612 x̄=496 Sx=3.625307869 n=8 |
T-Test from summary statistics | |
When the question gives the sample mean, standard deviation and size, press stat, ▶ ▶, choose 2:T-Test and move the cursor to Stats. Press enter to select it. |
T-Test Inpt:Data Stats μ0: x̄: Sx: n: μ:≠μ0 <μ0 >μ0 Calculate Draw |
Fill in μ0 as 50, x̄ as 54, Sx as 6 and n as 15. Choose the alternative ≠μ0 and press enter, then choose Calculate and press enter. Sx is the n - 1 standard deviation, not σx. and to 3 significant figures. |
T-Test μ≠50 t=2.581988897 p=.0217252432 x̄=54 Sx=6 n=15 |
Z-Test (σ given) | |
Use a z-test when the question gives the standard deviation σ of the population, for example σ = 5 with a sample of 20 values, mean 52.4 and (H_0: mu = 50). Press stat, ▶ ▶ to reach TESTS and choose 1:Z-Test. Move the cursor to Stats on the Inpt line and press enter. |
Z-Test Inpt:Data Stats μ0: σ: x̄: n: μ:≠μ0 <μ0 >μ0 Calculate Draw |
Fill in μ0 as 50, σ as 5, x̄ as 52.4 and n as 20. Choose the alternative ≠μ0 and press enter, then choose Calculate and press enter. The screen shows the test statistic z and the p-value p. (z = 2.15) and (p = 0.0318) to 3 significant figures. |
Z-Test μ≠50 z=2.146625258 p=.03182312739 x̄=52.4 n=20 |
Paired t-test (two lists, one test on the differences) | |
Use a paired test when the same people or things are measured twice, for example before and after a course, with before values 82, 75, 90, 68, 79 and after values 78, 74, 85, 66, 71, and the test is whether the mean of the differences (before minus after) is greater than 0. Press stat, choose 1:Edit, and clear L1 and L2 as above if they hold numbers. Type the before values into L1 and the after values into L2, pressing enter after each. Both lists must have the same number of values. |
L1 L2 82 78 75 74 90 85 68 66 79 71 |
Use ▶ and ▲ to put the cursor on the name L3 at the top of the third column. Press 2nd 1 (L1), then −, then 2nd 2 (L2), and press enter. L3 now holds the differences, the value in L1 minus the value in L2: 4, 1, 5, 2, 8. |
L1 L2 L3 82 78 4 75 74 1 90 85 5 68 66 2 79 71 8 |
Press stat, ▶ ▶ to reach TESTS and choose 2:T-Test, with Inpt on Data. Type 0 for μ0 and set List to L3 (2nd 3). Choose the alternative >μ0 to match H1, press enter, then choose Calculate and press enter. The screen shows t, p, the mean of the differences x̄, Sx and n. and to 3 significant figures, with degrees of freedom. |
T-Test μ>0 t=3.265986324 p=.01545291737 x̄=4 Sx=2.738612788 n=5 |
The alternative on the μ line must match H1. Choose Calculate for the numbers and Draw only if you want the picture of the t-distribution with the p-value shaded.
How to do a t-test for a mean on a Casio fx-CG50
1-SAMPLE t Test (from a list of data) | |
Press MENU and choose Statistics. The List Editor opens. If List 1 already has numbers in it, move to any value in List 1, press F6 to show more function keys, then F4 (DEL-ALL) and F1 (Yes). |
|
Type the data into List 1, one value at a time, pressing EXE after each: 496, 503, 492, 497, 494, 499, 493, 494. |
List 1 496 503 492 497 494 499 493 494 |
Press F3 (TEST), then F2 (t), then F1 (1-SAMPLE). The settings screen for the test appears. |
|
Set Data to List. For μ choose the alternative that matches your H1 (here ≠). Type 5 0 0 for μ0, the mean in the null hypothesis, and set List to List1 and Freq to 1. |
1-Sample t Test Data:List μ:≠μ0 μ0:500 List:List1 Freq:1 Execute |
Move the highlighting down to Execute and press F1 (CALC). The results show t, the p-value p, the sample mean x̄, the standard deviation sx and the sample size n. and to 3 significant figures, with degrees of freedom. |
1-Sample t Test μ≠500 t=-3.12076 p=0.0168258 x̄=496 sx=3.62531 n=8 |
From summary statistics | |
Press F3 (TEST), F2 (t), F1 (1-SAMPLE) again, and set Data to Variable. Fill in μ0 as 50, x̄ as 54, sx as 6 and n as 15, choose ≠, move to Execute and press F1 (CALC). sx is the n - 1 standard deviation, not σx. and to 3 significant figures. |
1-Sample t Test μ≠50 t=2.58199 p=0.0217252 x̄=54 sx=6 n=15 |
1-SAMPLE Z Test (σ given) | |
Use a z-test when the question gives the standard deviation σ of the population, for example σ = 5 with a sample of 20 values, mean 52.4 and (H_0: mu = 50). Press F3 (TEST), then F1 (Z), then F1 (1-SAMPLE), and set Data to Variable. For μ choose ≠. Fill in μ0 as 50, σ as 5, x̄ as 52.4 and n as 20, pressing EXE after each, then move to Execute and press F1 (CALC). The results show z and the p-value p. (z = 2.15) and (p = 0.0318) to 3 significant figures. |
1-Sample Z Test μ≠50 z=2.14663 p=0.0318231 x̄=52.4 n=20 |
Paired t-test (two lists, one test on the differences) | |
Use a paired test when the same people or things are measured twice, for example before and after a course, with before values 82, 75, 90, 68, 79 and after values 78, 74, 85, 66, 71, and the test is whether the mean of the differences (before minus after) is greater than 0. Press MENU, choose Statistics and type the before values into List 1 and the after values into List 2, pressing EXE after each. Both lists must have the same number of values. |
List 1 List 2 82 78 75 74 90 85 68 66 79 71 |
Move the highlight up to the name List 3. Press OPTN, F1 (LIST), F1 (List), then type 1, −, press OPTN, F1 (LIST), F1 (List) again and type 2, then press EXE. List 3 now holds the differences, List 1 minus List 2: 4, 1, 5, 2, 8. |
List 1 List 2 List 3 82 78 4 75 74 1 90 85 5 68 66 2 79 71 8 |
Press F3 (TEST), F2 (t), F1 (1-SAMPLE). Set Data to List, choose > for μ to match H1, set μ0 to 0 and List to List3, and leave Freq as 1. Move to Execute and press F1 (CALC). The results show t, p, the mean of the differences x̄, sx and n. and to 3 significant figures, with degrees of freedom. |
1-Sample t Test μ>0 t=3.26599 p=0.0154529 x̄=4 sx=2.73861 n=5 |
Press 6 (DRAW) instead of 1 (CALC) at Execute to see the graph. After a graph, 1 (T) shows the t value and 2 (P) shows the p-value.
How to do a t-test for a mean on a Casio fx-CG100
1-Sample t Test (from a list of data) | |
Press HOME and choose Statistics. The List Editor tab opens. If List 1 already has numbers in it, highlight any value in it and press TOOLS, then choose Delete → One List. |
|
Type the data into List 1, one value at a time, pressing EXE after each: 496, 503, 492, 497, 494, 499, 493, 494. |
List 1 496 503 492 497 494 499 493 494 |
Press the next-tab key to move to the Setup tab. Highlight the first line, press OK and choose Hypothesis Test. Highlight line 2, press OK and choose t Test → 1-Sample t Test. |
Hypothesis Test 1-Sample t Test |
Highlight Data, press OK and choose List. Highlight μ, press OK and choose the direction that matches your H1 (here ≠). Highlight μ0, type 5 0 0, the mean in the null hypothesis, and press OK. Set List to List 1. |
Data:List μ:≠μ0 μ0:500 List:List 1 |
Press the next-tab key, or highlight Execute and press OK. The Results tab shows t, the p-value p, the sample mean x̄, the standard deviation sx and the sample size n. and to 3 significant figures, with degrees of freedom. |
1-Sample t Test μ≠500 t=-3.12076 p=0.0168258 x̄=496 sx=3.62531 n=8 |
From summary statistics | |
On the Setup tab choose 1-Sample t Test as above, but set Data to Variable. Fill in μ0 as 50, x̄ as 54, sx as 6 and n as 15, choose ≠, then press the next-tab key. sx is the n - 1 standard deviation, not σx. and to 3 significant figures. |
1-Sample t Test μ≠50 t=2.58199 p=0.0217252 x̄=54 sx=6 n=15 |
1-Sample Z Test (σ given) | |
Use a z-test when the question gives the standard deviation σ of the population, for example σ = 5 with a sample of 20 values, mean 52.4 and (H_0: mu = 50). On the Setup tab choose Hypothesis Test on the first line, then on line 2 press OK and choose Z Test → 1-Sample Z Test. Set Data to Variable and choose the direction ≠ for μ. |
Hypothesis Test 1-Sample Z Test Data:Variable μ:≠μ0 |
Fill in μ0 as 50, σ as 5, x̄ as 52.4 and n as 20, pressing OK after each. Highlight Execute and press OK. The Results tab shows z and the p-value p. (z = 2.15) and (p = 0.0318) to 3 significant figures. |
1-Sample Z Test μ≠50 z=2.14663 p=0.0318231 x̄=52.4 n=20 |
Paired t-test (two lists, one test on the differences) | |
Use a paired test when the same people or things are measured twice, for example before and after a course, with before values 82, 75, 90, 68, 79 and after values 78, 74, 85, 66, 71, and the test is whether the mean of the differences (before minus after) is greater than 0. Press HOME, choose Statistics and type the before values into List 1 and the after values into List 2, pressing EXE after each. Both lists must have the same number of values. |
List 1 List 2 82 78 75 74 90 85 68 66 79 71 |
Highlight the name List 3. Input List 1 from the variables menu, press −, input List 2 the same way, and press EXE. List 3 now holds the differences, List 1 minus List 2: 4, 1, 5, 2, 8. |
List 1 List 2 List 3 82 78 4 75 74 1 90 85 5 68 66 2 79 71 8 |
Move to the Setup tab and choose Hypothesis Test, then t Test → 1-Sample t Test. Set Data to List, choose the direction > for μ to match H1, set μ0 to 0 and List to List 3. Highlight Execute and press OK. The Results tab shows t, p, the mean of the differences x̄, sx and n. and to 3 significant figures, with degrees of freedom. |
1-Sample t Test μ>0 t=3.26599 p=0.0154529 x̄=4 sx=2.73861 n=5 |
The direction on the μ line must match H1. The graph tab after the results shows the t-distribution with the p-value area shaded.
How to do a t-test for a mean on a TI-Nspire CX
t Test (from a list of data) | |
Open a new document and add a Lists & Spreadsheet page. Press ▲ to move to the name cell at the top of column A, type data and press enter. This makes the column a list called data. |
|
Type the data into column A, one value at a time, pressing enter after each: 496, 503, 492, 497, 494, 499, 493, 494. |
A data 496 503 492 497 494 499 493 494 |
Add a Calculator page. Press menu → Statistics → Stat Tests → t Test. Set Data Input Method to Data and choose OK. |
t Test Data Input Method: Data |
Fill in the fields, moving between them with tab. Type 5 0 0 for μ0, the mean in the null hypothesis, set List to data and leave Frequency List as 1. For Alternate Hyp choose the alternative that matches your H1 (here μ ≠ μ0). Choose OK. |
μ0:500 List:data Frequency List:1 Alternate Hyp:μ ≠ μ0 |
The results are listed: t, the p-value PVal, the degrees of freedom df, the sample mean x̄, the standard deviation sx and the sample size n. and to 3 significant figures, with degrees of freedom. |
t Test Alternate Hyp: μ≠500 t:-3.12076 PVal:0.0168258 df:7 x̄:496 sx:3.62531 n:8 |
From summary statistics | |
Open t Test as above, but set Data Input Method to Stats. Fill in μ0 as 50, x̄ as 54, sx as 6 and n as 15, choose the alternative μ ≠ μ0 and choose OK. sx is the n - 1 standard deviation, not σx. and to 3 significant figures. |
t Test Alternate Hyp: μ≠50 t:2.58199 PVal:0.0217252 df:14 x̄:54 sx:6 n:15 |
Another way: type the command | |
On a Calculator page type |
tTest 50,54,6,15 stat.results |
z Test (σ given) | |
Use a z-test when the question gives the standard deviation σ of the population, for example σ = 5 with a sample of 20 values, mean 52.4 and (H_0: mu = 50). On a Calculator page type (z = 2.15) and (p = 0.0318) to 3 significant figures. |
zTest 50,5,52.4,20 z:2.14663 PVal:0.0318231 |
Paired t-test (two columns, one test on the differences) | |
Use a paired test when the same people or things are measured twice, for example before and after a course, with before values 82, 75, 90, 68, 79 and after values 78, 74, 85, 66, 71, and the test is whether the mean of the differences (before minus after) is greater than 0. On a Lists & Spreadsheet page, name column A before and column B after (move to the name cell with ▲, type the name and press enter), then type the before values into A and the after values into B, pressing enter after each. Both columns must have the same number of values. |
A before B after 82 78 75 74 90 85 68 66 79 71 |
Name column C d in the same way. Move to its formula cell, the second cell from the top, type |
C d 4 1 5 2 8 |
Add a Calculator page. Press menu → Statistics → Stat Tests → t Test and set Data Input Method to Data. Type 0 for μ0, set List to d, choose the alternative μ > μ0 to match H1 and choose OK. The results list t, PVal, df, the mean of the differences x̄, sx and n. and to 3 significant figures, with degrees of freedom. |
t Test Alternate Hyp: μ>0 t:3.26599 PVal:0.0154529 df:4 x̄:4 sx:2.73861 n:5 |
The alternative must match H1. The p-value is PVal, and it is already for the alternative you chose: do not halve or double it.
Sources. Key presses follow the manufacturers' documentation: the TI-84 Plus CE eGuide, the TI-Nspire eGuide, the Casio fx-CG50 Software User's Guide (version 3.30) and the Casio fx-CG100 online manual.
What to write in the exam
- State the hypotheses and the significance level first. Write and (, or ) before you use the calculator.
- Write the test statistic and the p-value, for example and , and say you found them using your calculator. Do not write the key presses.
- Compare p with the significance level and give the decision: if the level, reject ; otherwise do not reject .
- Finish with a conclusion in context, in words about the situation in the question, not just "reject ".
- Use the standard deviation s when you enter summary statistics, and state the assumption that the population is normally distributed (or the sample is large).
- Check which papers allow a calculator. In AI HL a calculator is allowed on every paper (check your syllabus).
Reading the result
The test gives t, the test statistic , and the p-value, the probability of a result at least as extreme as the sample if is true. The degrees of freedom are , which is for the sample above. A small p-value is evidence against . For how to compare p with the significance level, see interpreting p-values, significance levels and errors.
One-tailed tests
Choose the alternative that matches : not equal for , less than for , greater than for . For the summary statistics above (mean 54, standard deviation 6, 15 values, ), the two-tailed test gives and the test with gives . The calculator already adjusts the p-value for the alternative you chose, so use it as shown.
Error messages and what to do
| Calculator | Message | Usual cause | What to try |
|---|---|---|---|
| TI-84 Plus CE | ERR:STAT | The list holds fewer than two values, or the Freq list has a negative entry. | Check that L1 holds all the data and that Freq is 1 or a list of whole numbers of zero or more. |
| TI-84 Plus CE | ERR:DOMAIN | An input is outside its valid range, for example a standard deviation Sx of zero or less. | Check Sx and n: Sx must be positive and n a whole number. |
| TI-84 Plus CE | ERR:DIMENSION MISMATCH | The data list and the Freq list have different lengths, or the two lists subtracted for a paired test do not have the same number of values. | Make the lists the same length, or set Freq back to 1. |
| Casio fx-CG50 | No Data | The list named in the List line is empty. | Enter the data in the List Editor, or choose the list that holds it. |
| Casio fx-CG50 | Out of Domain | An input is outside its allowed range, for example a negative frequency or a standard deviation sx of zero or less. | Correct the value: sx must be positive and frequencies zero or more. |
| Casio fx-CG100 | Out of Domain | The frequency list contains a negative value. | Correct the frequency list: frequencies must be zero or more. |
| Casio fx-CG100 | Dimension ERROR | The data list and the frequency list, or the two lists subtracted for a paired test, have different numbers of values. | Make the two lists the same length. |
| TI-Nspire CX | Dimension mismatch | The data list and the frequency list, or the two columns subtracted for a paired test, do not have the same number of values. | Make the two lists the same length. |
| TI-Nspire CX | Domain error | An input is outside its valid range, for example a standard deviation sx of zero or less. | Check sx and n: sx must be positive. |
Common mistakes
- Reversing the differences. For a paired test the direction of the subtraction decides the alternative: if the differences are before minus after, "times fall" is (mu_d > 0), but after minus before makes it (mu_d < 0).
- Choosing the wrong alternative. The ≠, < or > on the μ line must match H1. A one-tailed question needs < or >.
- Entering σx instead of s. For summary statistics the test needs the standard deviation s (sx or Sx).
- Putting the sample mean in the μ0 line. μ0 is the mean in H0, the value being tested. The sample mean goes in the data or the x-bar line.
- Leaving an old frequency list switched on. Keep Freq at 1 for a plain list of data.
- Changing the p-value. Do not halve or double it: the calculator has already used the alternative you chose.
- Writing key presses as working. Write the hypotheses, t, the p-value, the decision and a conclusion in context.
Practise with your calculator
Choose your course to see the practice sets that use this skill. You can also try practice mode or browse every GDC guide.
Quick questions
How do I do a t-test for a mean on a calculator?
Open the one-sample t-test: T-Test on the TI-84 Plus CE (stat, TESTS), 1-SAMPLE under TEST then t on the fx-CG50, Hypothesis Test then 1-Sample t Test on the fx-CG100, or t Test under Stat Tests on the TI-Nspire. Enter the hypothesised mean and either the data or the summary statistics, choose the alternative hypothesis, and read t and the p-value.
Which standard deviation do I enter?
Enter the standard deviation s (sx or Sx), the one with n - 1 in the formula. If you enter the data as a list, the calculator works it out for you.
How do I know whether to reject the null hypothesis?
Compare the p-value with the significance level. If p is smaller than the level, for example 0.05, reject H0. If it is larger, do not reject H0. Then say what that means in the context of the question.
When do I use a z-test instead of a t-test?
Use a z-test when the question gives the standard deviation (sigma): Z-Test on the TI-84 Plus CE, 1-SAMPLE under TEST then Z on the fx-CG50, Z Test then 1-Sample Z Test on the fx-CG100, or zTest on the TI-Nspire. When only s is known, use the t-test.
How do I do a paired t-test on a calculator?
Put the before values and the after values in two lists of the same length, make a third list holding the differences (first list minus second list), then run the one-sample t-test on that list with μ0 = 0. Choose the alternative that matches H1 for the mean difference. The test statistic and p-value are those of the paired test.
Does the calculator give the degrees of freedom?
The TI-Nspire lists df with the results. On the other calculators the degrees of freedom for a one-sample test are n - 1.