IB Maths Help logoIB Maths Help

Hypothesis test for correlation

Test the hypothesis that the population product moment correlation coefficient is zero, using the linear regression t-test, 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.

Used inAI HL

Enter the paired data in two lists and run the linear regression t-test, choosing the sign that matches your alternative hypothesis. The calculator gives the test statistic tt, the p-value, the degrees of freedom n−2n - 2 and the correlation coefficient rr. Compare the p-value with the significance level: if it is smaller, reject H0ρ=0H_0\: \rho = 0 and conclude there is evidence of correlation. Otherwise there is not enough evidence.

Example

A teacher records the number of hours, xx, that 8 students spent revising and their test marks, yy.
xx: 2, 3, 4, 5, 6, 7, 8, 9
yy: 52, 47, 60, 55, 68, 61, 66, 64
The data come from a bivariate normal distribution. Test, at the 5% significance level, whether there is evidence of correlation between hours of revision and test mark.

State the hypotheses: H0:ρ=0H_0: \rho = 0 and H1:ρ≠0H_1: \rho \ne 0, where ρ\rho is the population correlation coefficient. The linear regression t-test gives t=3.09t = 3.09 on 66 degrees of freedom and p=0.0215p = 0.0215, with r=0.783r = 0.783. Since 0.0215<0.050.0215 \lt 0.05, reject H0H_0. There is evidence at the 5% level of a positive linear correlation between hours of revision and test mark.

Choose your calculator

How to test for correlation on a TI-84 Plus CE

LinRegTTest

Press stat and choose 1:Edit.... Type the xx-values into L1, pressing enter after each: 2, 3, 4, 5, 6, 7, 8, 9. Type the yy-values into L2: 52, 47, 60, 55, 68, 61, 66, 64. Both lists must have the same number of values.

L1 L2
2 52
3 47
4 60
5 55
...

Press stat, then ▶ ▶ to move past CALC to TESTS, and choose F:LinRegTTest. With the Stat Wizards on, set Xlist to L1 with 2nd 1, Ylist to L2 with 2nd 2 and Freq to 1. For β & ρ choose the sign that matches your alternative hypothesis, ≠ 0 for a two-tailed test, and leave RegEQ empty.

LinRegTTest
Xlist:L1
Ylist:L2
Freq:1
β & ρ:≠0
Calculate

Choose Calculate and press enter. The screen shows t, p, df, then a and b for the line of best fit, the standard error s, and r² and r. Use ▼ to scroll to the last two.

t=3.09t = 3.09, p=0.0215p = 0.0215, df=6df = 6 and r=0.783r = 0.783.

LinRegTTest
y=a+bx
β≠0 and ρ≠0
t=3.086695206
p=.02147836376
df=6
a=46.35714286
b=2.321428571
s=4.874007836
r²=.613593455
r=.7833220634

A p-value is in the output, so you do not need a table of critical values. For a one-tailed test choose < 0 or > 0 for the sign, and the p-value is then for that one tail.

How to test for correlation on a Casio fx-CG50

LinearReg t Test

Press MENU and choose Statistics. Type the xx-values into List 1, pressing EXE after each: 2, 3, 4, 5, 6, 7, 8, 9. Type the yy-values into List 2: 52, 47, 60, 55, 68, 61, 66, 64.

List 1 List 2
2 52
3 47
4 60
5 55
...

With the List Editor on screen, press F3 (TEST), then F2 (t), then F3 (REG). For β & ρ choose the direction that matches your alternative hypothesis, ≠0 for a two-tailed test. Set XList to List 1, YList to List 2 and Freq to 1.

LinearReg t Test
β & ρ:≠0
XList:List1
YList:List2
Freq:1

Move down to Execute and press F1 (CALC). The screen shows t, p and df, then a and b for the line of best fit, the standard error s, and r and r²: scroll down with ▼.

t=3.09t = 3.09, p=0.0215p = 0.0215, df=6df = 6 and r=0.783r = 0.783.

β≠0 & ρ≠0
t=3.0866952
p=0.0214784
df=6
a=46.3571429
b=2.3214286
s=4.8740078
r=0.7833221
r²=0.6135935

This test has no graph. If you want the line of best fit as well, the steps are in the linear regression guide.

How to test for correlation on a Casio fx-CG100

Linear Regression t Test

Press HOME and choose Statistics. In the List Editor type the xx-values into List 1, pressing EXE after each: 2, 3, 4, 5, 6, 7, 8, 9. Type the yy-values into List 2: 52, 47, 60, 55, 68, 61, 66, 64.

List 1 List 2
2 52
3 47
4 60
5 55
...

Press the next-tab key to reach the Setup tab. Highlight the first line, press OK and choose Hypothesis Test. Highlight line 2, press OK, choose t Test and then Linear Regression t Test.

Hypothesis Test
LinearReg t Test

The screen shows β & ρ, XList, YList and Freq. For β & ρ choose the direction that matches your alternative hypothesis, ≠0 for a two-tailed test, and check that XList is List 1 and YList is List 2. Press the next-tab key to run the test.

β & ρ:≠0
XList:List1
YList:List2
Freq:1

The Results tab shows t, p and df, then a and b for the line of best fit, the standard error se, and r and r²: scroll down with ▼.

t=3.09t = 3.09, p=0.0215p = 0.0215, df=6df = 6 and r=0.783r = 0.783.

LinearReg t Test
β≠0 & ρ≠0
t=3.08669521
p=0.02147836
df=6
a=46.3571429
b=2.32142857
se=4.87400784
r=0.78332206
r²=0.61359346

The test uses the whole of both lists, so clear any old values out of List 1 and List 2 first, and make sure the two lists are the same length.

How to test for correlation on a TI-Nspire CX

Linear Reg t Test

Press home and choose Lists & Spreadsheet. In the top cell of column A type the name x and press enter, then type the xx-values below it, pressing enter after each: 2, 3, 4, 5, 6, 7, 8, 9. In column B use the name y and type the yy-values: 52, 47, 60, 55, 68, 61, 66, 64.

A: x B: y
2 52
3 47
4 60
5 55
...

Press menu → Statistics → Stat Tests → Linear Reg t Test. Set X List to x, Y List to y and Freq List to 1. For Alternate Hyp choose β & ρ ≠ 0 for a two-tailed test, then choose OK.

X List:x
Y List:y
Freq List:1
Alternate Hyp:β & ρ ≠ 0

The results fill the spreadsheet: look for t, PVal, df, then a and b for the line of best fit, s, r² and r.

t=3.09t = 3.09, p=0.0215p = 0.0215, df=6df = 6 and r=0.783r = 0.783.

Linear Reg t Test
t 3.0867
PVal 0.0214784
df 6
a 46.3571
b 2.32143
s 4.87401
r² 0.613593
r 0.783322

The p-value is called PVal on the results screen. Check the Alternate Hyp line matches the test you were asked to do before you read 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

  • Write the hypotheses first. H0:ρ=0H_0: \rho = 0 and H1:ρ≠0H_1: \rho \ne 0 for a test for any correlation, or H1:ρ>0H_1: \rho \gt 0 or H1:ρ<0H_1: \rho \lt 0 when the question names a direction. ρ\rho is the population correlation coefficient.
  • Quote the p-value and the significance level. Write p=0.0215p = 0.0215 and compare it with the level, for example 0.0215<0.050.0215 \lt 0.05. Do not write the key presses.
  • Conclude in context, in two parts. First the decision: reject or do not reject H0H_0. Then the meaning: there is, or is not, sufficient evidence of correlation between the two named quantities. Say "evidence", not "proof".
  • Do not say the correlation causes the effect. A significant correlation shows a linear association, not that one variable causes the other.
  • The data will be given. In an examination you are given the data, and the question tells you the data come from a bivariate normal distribution. You do not have to test that assumption.

One-tailed tests and no evidence of correlation

The test is about the population correlation ρ\rho, using the sample correlation rr from the linear regression guide: line of best fit and r. For ranked data use Spearman's rank correlation coefficient. The ideas of p-values and significance levels are in p-values, significance levels and errors.

Error messages and what to do

CalculatorMessageUsual causeWhat to try
TI-84 Plus CEERR:DIMENSION MISMATCHThe x list and the y list do not have the same number of values.Make the two lists the same length.
Casio fx-CG50Dimension ERRORThe x list and the y list do not have the same number of values.Check the dimension of the lists and make them the same length.
Casio fx-CG100Dimension ERRORThe x list and the y list do not have the same number of values.Check the dimension of the lists and make them the same length.
TI-Nspire CXDimension mismatchThe x list and the y list have a different number of values.Make the two lists the same length.

Common mistakes

  • Reading rr instead of the p-value. The decision comes from comparing the p-value with the significance level, not from how big rr looks.
  • Using the wrong sign. Choose the sign that matches the alternative hypothesis before you run the test: a one-tailed test has a different p-value from a two-tailed test.
  • Writing the conclusion as proof. Say there is evidence of correlation at the stated level, not that the variables are correlated for certain.
  • Treating the result as cause and effect. A significant correlation does not mean one variable causes the other.
  • Unequal lists. The xx and yy lists must have the same number of values, or the calculator gives a dimension error.

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 test whether a correlation is significant on a calculator?

Enter the paired data in two lists and run the linear regression t-test: LinRegTTest on the TI-84 Plus CE, the REG test in the t tests on the fx-CG50, Linear Regression t Test under Hypothesis Test on the fx-CG100, or Linear Reg t Test under Stat Tests on the TI-Nspire. Choose the sign that matches your alternative hypothesis, then read the p-value and compare it with the significance level.

What are the hypotheses for a test for correlation?

The null hypothesis is that the population product moment correlation coefficient is zero, H0: rho = 0. The alternative hypothesis is rho not equal to 0 for a two-tailed test, or rho greater than 0 or rho less than 0 for a one-tailed test.

How many degrees of freedom does the test use?

The test uses n - 2 degrees of freedom, where n is the number of pairs of data. The calculator shows this as df.

What do I write as the conclusion?

If p is less than the significance level, reject H0 and write that there is sufficient evidence of correlation between the two named quantities at that level. If p is greater, do not reject H0 and write that there is not sufficient evidence of correlation.