Chapter 11 Pearson Correlation

A correlation coefficient assesses the degree of linear relationship between two quantitative variables. It can take values from +1 to -1.

11.1 Overview

The previous statistical test that we studied (Chi-Square Test of Independence) involved the relationship between a categorical explanatory variable and a categorical response variable. Next, we will consider inference in the context of relationships between two quantitative variables, corresponding to case Q->Q. The Pearson Correlation examines our observed data and evaluates whether we have enough evidence to conclude with a reasonable level of certainty (p<0.05) that there is a relationship between two quantitative variables. A correlation coefficient evaluates the degree of linear relationship between two variables. It ranges from +1 to -1. A correlation of +1 means that there is a perfect, positive, linear relationship between the two variables. A correlation of -1 means there is a perfect, negative linear relationship between the two variables. In both cases, knowing the value of one variable, you can perfectly predict the value of the second.

11.2 Lesson

Learn about the Pearson Correlation test. Consider the null and alternative hypothesis when using this test. See how the strength and direction of the relationship between the two variables plays a role in our evaluation of statistical significance. Learn how to run a Pearson Correlation and interpret results within the context of real data. Click on a video lesson below.


SAS                     R                     Python                     Stata                     SPSS


11.3 Syntax

SAS

proc corr;
    var QuantResponseVar QuantExplanatoryVar;

R

cor.test(myData$QuantResponseVar, myData$QuantExplanatoryVar)

Python

import scipy
sub1= myData[['QuantResponseVar', '
QuantExplanatoryVar']].dropna()
print ('association between QuantExplanatoryVar and
QuantResponseVar')
print (scipy.stats.pearsonr(sub1['QuantResponseVar'],
sub1 ['QuantExplanatoryVar']))

STATA

corr QuantResponseVar QuantExplanatoryVar
// or
pwcorr QuantResponseVar QuantExplanatoryVar, sig

SPSS

CORRELATIONS/VARIABLES= QuantResponseVar
QuantExplanatoryVar/STATISTICS DESCRIPTIVES.

11.4 Assignment

Run a Pearson Correlation using a quantitative response variable and a quantitative explanatory variable. State your research question, the null and alternate hypotheses and whether or not the Correlation Coefficient is statistically significant. Submit your output. Describe your results.