Correlation
Correlation
Comparisons
So far, our inferential statistics have focused on comparing populations:
Single-sample t- and Z-tests
Whether a sample comes from a known population
Independent- and dependent-samples t-tests
Whether two samples are from the same population
ANOVAs
Whether 3+ samples are from the same population
What about relationships within a single population?
Correlation
Regression
Correlation
Correlations represent the systematic relationship between two variables
Correlation
Two main properties of a correlation:
Directionality
The nature of the relationship between the variables
Negative
the variables go opposite directions
Variable X
Variable Y
Variable X
Variable Y
Positive
the variables go in same direction
Variable X
Variable Y
Variable X
Variable Y
Correlation
Two main properties of a correlation:
Strength
The consistency in the relationship between the variables
Weak
Variables are inconsistently related
Strong
Variables are consistently related
Extreme values in X paired with extreme values in Y
Correlation
These relationships are quantified by a correlation coefficient
We are going to use Pearson’s correlation coefficient: r
r can take any value from -1.00 to +1.00
The sign of r (- / +) indicates the direction of the relationship
The absolute value (magnitude) of r indicates the strength of the relationship
| Small | .10 |
| Medium | .30 |
| Large | .50 |
Correlation
Correlations can be visualized using a scatterplot
Correlation is not causation!
Correlation is not causation!
Correlation
Limitations
Causal direction
Both directions of causality are possible
Chocolate consumption
Nobel Prizes
Correlation
Limitations
Third variable
Some other variable is related to both our variables and accounts for their (illusory) relationship
Chocolate consumption
Nobel Prizes
Distance from chocolate exporters
Correlation
What sort of correlation would be expected between bacon consumption and incidence of heart disease?
Large positive
r = .93
0.808384451578262 0.31707895447840873 0.27351462032047791 2.83728929669152 3.3196323073699969 4.8661629653941993 4 6 6.95338694470904 9.9899067309071548 2.0762115383013353 8.2461074432837425 8.263125488967928 2 3.6641382214845692 2 1.1584900756344139 0.66287823610600805 3.7744957296845962 3.891456417678576 4 6.0218357487684102 6.8862399105700094 6.6582346803747612 8.228911669781068 2.8181525741086317 6.7463428855894678 8.8000000000000007 3.4050910374648589 1.9847534851783799
Bacon consumption
Incidence of heart disease
Correlation
What sort of correlation would be expected between amount of leisure time spent reading and the amount of time watching TV?
Small negative
r = -.24
9.1688150870649334 9.3011418018712497 2.3585754605711458 1.2490875096993097 6.6817574788203142 1.2671861856748579 5.5214739261711552 8.2943169653434659 4.3534937782587626 4.5121887492041459 5.7997573344632727 2.3586399114545267 2.5111845221409892 3.357493588688043 6.2841983504225176 2.7859789982676402 4 1.358057216466835 4.4676706172027476 3.6 5.3450036792509366 2 2.2008944743732477 1.524448432622131 3.6223800830138577 3 6 4.665232696279535 0.63912145471084281 4.2513680963590446
Time spent watching TV
Time spent reading
Correlation
What sort of correlation would be expected between a person’s height and the length of their daily commute?
No correlation
r = .02
6.2992848989980565 2.116995798816105 4.0936784406566824 0.60827419416145201 7.9987485160859775 7.8239580138929865 1.3571558491382356 1.1247709765073601 7.4006526377676316 3.8714522840605898 4.2459020580225779 7.8711351156365303 1.4348085386906819 9.4909175312641043 5.3998053869649318 9.1886016451185419 9.8810764098491148 5.260089256776765 4.9138907562314946 8.8750997235192379 3.6008618987657002 5 5.1818947747326174 4.611387755098141 7.9019378163385845 9.1018376402311389 8.7599036223153188 2.0515148443411402 2.0774944499132539 3.462289505501603
Length of commute
Height
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so too have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
| Superhero | Debut | Height (in.) |
| Gambit | 1990 | 6’2” (74) |
| The Hulk | 1962 | 7’ (84) |
| Aquaman | 1941 | 6’1” (73) |
| Jetstream | 1984 | 5’7” (67) |
| Daredevil | 1940 | 6’ (72) |
| Silver Surfer | 1966 | 6’4” (76) |
| Captain Britain | 1976 | 6’6” (78) |
| Wolverine | 1974 | 5’3” (63) |
| Superman | 1938 | 6’3” (75) |
| Green Lantern | 1959 | 6’ (72) |
Steps of hypothesis-testing
1. Select test.
2. State the null and research hypotheses
3. Describe the distribution of the null hypothesis.
4. Determine the critical values.
5. Calculate the test statistic.
6. Make a decision.
Steps of hypothesis-testing
Are you trying to test how one variable changes when another variable changes?
Correlation – r
Assumptions
Normal population
Each variable shows similar variability
No “outliers”
1. Select test.
Assumptions
Each variable shows similar variability
Is the “spread” in one variable about the same at each level of the other?
Assumptions
Each variable shows similar variability
Is the “spread” in one variable about the same at each level of the other?
Assumptions
No extreme outliers
This can greatly affect the correlation even though it is spurious
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
Y-Values 1990 1962 1941 1984 1940 1966 1976 1974 1938 74 84 73 67 72 76 78 63 75
Year of Debut
Height (inches)
Steps of hypothesis-testing
Describe the two mutually exclusive possibilities in words and symbolically
Hypotheses about the relationship between two variables across the population
Correlation coefficients = the amount of variance in one variable predicted by variance in the other variable
2. State the null and research hypotheses
r =
Amount of common variance
Amount of total variance
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
Research hypothesis (H1):
There is a correlation between superhero height and the year of debut.
H1: ρ ≠ 0
Note: Our book only allows non-directional tests of correlations
In reality, could do directional
Null hypothesis (H0):
There is not a positive correlation between superhero height and the year of debut.
H0: ρ = 0
Steps of hypothesis-testing
Well, not really a unique step here for correlations…
…So let’s just use this step to make sure we know our df
3. Describe the distribution of the null hypothesis.
Steps of hypothesis-testing
Behind the scenes, r’s are tested with t’s, so is a family of distributions based on dfs
Because we will be computing variance for each variable, we lose two degrees of freedom
df = n – 2
3. Describe the distribution of the null hypothesis.
df = 5
df = 25
df = 50
df = 50
larger df = narrower distribution
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
Distribution: r-distribution with 8 dfs
Steps of hypothesis-testing
4. Determine the critical values.
Consult table H
As always, use smaller df if what you need isn’t there
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
Critical value(s):
rcrit = ±0.6319
Look up in Table H
df = 8
α = .05
Remember you must include ±
Tests are non-directional
Steps of hypothesis-testing
Common variance: What is “shared” between the two variables
What makes them “go together” (if they do)
Total variance: All the variance in our variables
5. Calculate the test statistic.
r =
Amount of common variance
Amount of total variance
Calculating r
Our old friend the deviation!
X – M
But now we’ve got two deviations per raw score
X – MX
Y – MY
| Person | X | Y |
| A | 1 | 2 |
| B | 2 | 3 |
| C | 5 | 4 |
| D | 6 | 7 |
| E | 7 | 6 |
| M = 4.2 | M = 4.4 |
Calculating r
Visualizing joint deviations in a positive correlation
Both deviations are positive
(7-4.2) & (6-4.4)
Both deviations are negative
(2-4.2) & (3-4.4)
X
Y
For positive correlations:
For a given raw score both deviations will (usually) be negative
OR
both deviations will (usually) be positive
1 2 5 6 7 2 3 4 7 6
Calculating r
Visualizing joint deviations in a negative correlation
One deviation pos, one deviation neg
(2-4.2) & (7-4.4)
One deviation pos, one deviation neg
(7-4.2) & (2-4.4)
X
Y
For negative correlations:
For a given raw score the two deviations will (usually) have opposite signs
1 2 5 6 7 6 7 4 3 2
Calculating r
Numerator of r is the Sum of Products – SP
Created by multiplying the two deviations and then summing
Positive correlations will have positive products
+ times + is +
- times - is +
Negative correlations will have negative products
+ times - is –
r =
Amount of common variance
Amount of total variance
Calculating r
Products also keep track of strength
For Strong correlations:
When one deviation is big, the other is big
X
Y
1 2 5 6 7 2 3 4 7 6
Calculating r
Products also keep track of strength
For weak correlations:
Deviations tend to cancel each other out
X
Y
1 2 5 6 7 2 3 4 7 6
Calculating r
Now we need to compare this to the overall (expected) variability
We start with SS for each variable
Takes into account sample size
Then we take the square root of the product
Deals with the squared deviations
This measure of overall variability is our denominator:
r =
Amount of common variance
Amount of total variance
Calculating r
Therefore, the correlation coefficient is just the standardized form of SP
Standardized so that it ranges from -1 to 1
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
| Debut (X) | Height (Y) | (X-MX) | (Y-MY) | (X-MX)(Y-MY) |
| 1990 | 74.000 | 27.000 | 0.600 | 16.200 |
| 1962 | 84.000 | -1.000 | 10.600 | -10.600 |
| 1941 | 73.000 | -22.000 | -0.400 | 8.800 |
| 1984 | 67.000 | 21.000 | -6.400 | -134.400 |
| 1940 | 72.000 | -23.000 | -1.400 | 32.200 |
| 1966 | 76.000 | 3.000 | 2.600 | 7.800 |
| 1976 | 78.000 | 13.000 | 4.600 | 59.800 |
| 1974 | 63.000 | 11.000 | -10.400 | -114.400 |
| 1938 | 75.000 | -25.000 | 1.600 | -40.000 |
| 1959 | 72.000 | -4.000 | -1.400 | 5.600 |
Calculating the numerator (SP)
MX = 1963 MY = 73.400
SP = -169.000
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
| Debut (X) | Height (Y) | (X-MX) | (Y-MY) | (X-MX)2 | (Y-MY)2 |
| 1990 | 74.000 | 27.000 | 0.600 | 729.000 | 0.360 |
| 1962 | 84.000 | -1.000 | 10.600 | 1.000 | 112.360 |
| 1941 | 73.000 | -22.000 | -0.400 | 484.000 | 0.160 |
| 1984 | 67.000 | 21.000 | -6.400 | 441.000 | 40.960 |
| 1940 | 72.000 | -23.000 | -1.400 | 529.000 | 1.960 |
| 1966 | 76.000 | 3.000 | 2.600 | 9.000 | 6.760 |
| 1976 | 78.000 | 13.000 | 4.600 | 169.000 | 21.160 |
| 1974 | 63.000 | 11.000 | -10.400 | 121.000 | 108.160 |
| 1938 | 75.000 | -25.000 | 1.600 | 625.000 | 2.560 |
| 1959 | 72.000 | -4.000 | -1.400 | 16.000 | 1.960 |
Calculating the denominator
MX = 1963 MY = 73.400
SSX = 3124.000 SSY = 296.400
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
SP = -169.000 SSX = 3124.000 SSY = 296.400
Steps of hypothesis-testing
Compare your computed r to the critical r from step 4
r computed = -.18 > -.6319 = r crit
Reject or Fail to reject the null hypothesis
In this example, we retain, p > .05
6. Make a decision.
Sheldon’s example
Sheldon is convinced that there is a positive correlation between superhero height and the year they debuted. He thinks that since humans have been getting taller over the years, so to have their superheroes. He’s collected the following random sample of 10 superheroes to assess his claim.
I could not reject the null hypothesis because these superheroes’ heights did not positively correlate with their year of debut, r(8) = -0.18, p > .05.
Partial correlation
Do taller people have deeper voices?
What if you found r = .6?
Is there a THIRD VARIABLE that is really driving this effect?
Sex?
Men taller on average
Men deeper voices on average
Could be sex, not height itself driving effect
Partial correlation
When we create a partial correlation we:
Control for, remove, partial out…
…variance from one variable that potentially obscures or changes the correlation between two other variables
Once we partial out sex from the correlation between height and pitch, is there any correlation left?
Partial correlations allow us to “decontaminate” correlations
Often useful when do not have complete experimental control
Visualizing partial correlations
Genuine: correlation holds within both groups
Not Genuine: correlation holds in 1 group, not other
Not Genuine: No correlation in either group;
Mean difference in groups creates appearance of correlation
Not Genuine: within groups, correlation goes opposite direction;
Mean difference in groups creates appearance of correlation
Partial correlation
All three variables can be continuous, too
What if there was a correlation between age and salary?
Do people just give more money to older workers?
Or is it simply that older workers have more years of experience?
Partial out years of experience to see if there is still a correlation between age and salary
Foreshadowing: What if there are independent contributions of age and years of experience?
Computing partial correlation
rxy is the correlation of interest
Z is the variable to partial out
rxy.z is the correlation of interest once Z is partialed out
rxz and ryz are the correlations of X and Y with Z
So, you will need to compute three separate correlations before you can actually compute rxy.z
Hypothesis testing for partial correlations
Some changes in how to describe your hypotheses and how to describe your results
See cheat sheet at end
Now have to compute 3 correlations before computing partial correlation
DF = N – 3 for partial correlations
We have to estimate another variance for the third variable
What to report in homework
All the steps of hypothesis testing
Make sure both English and symbolic hypotheses
Make sure to explicitly compare computed r and critical r
All your work and equations computing r, including SP and the two SS’s
Description of what you found, see following page
Include your correlation and df in your description
Hypotheses - standard
H1: There is a correlation between height and voice pitch
ρ ≠ 0
H0: There is no correlation between height and voice pitch
ρ = 0
Remember, our book doesn’t give the option for one-tailed correlations
Hypotheses - partial
H1: There is a correlation between height and voice pitch when controlling for sex
ρ ≠ 0
H0: There is no correlation between height and voice pitch when controlling for sex
ρ = 0
Remember, our book doesn’t give the option for one-tailed correlations
Description - standard
“We can reject the null hypothesis and conclude that here was a statistically significant positive correlation between height and deepness of voice such that taller people had deeper voices, r(12) = .65, p < .05”
“We must retain the null and conclude there is no correlation between income and charitable giving, r(7) = -.03, p > .05.”
For all descriptions, describe the variables.
For significant correlations also:
Describe the sign, pos or neg
Describe how that played out in the varibles.
In r(#), the # is your df – don’t forget to put the right one
Description - partial
“We can reject the null hypothesis and conclude that here was a statistically significant positive correlation between height and deepness of voice when controlling for sex such that taller people had deeper voices, r(12) = .65, p < .05”
“We must retain the null and conclude there is no correlation between income and charitable giving when controlling for political ideology, r(7) = -.03, p > .05.”
For all descriptions, describe the variables.
For significant correlations also:
Describe the sign, pos or neg
Describe how that played out in the varibles.
In r(#), the # is your df – don’t forget to put the right one
Degrees of freedom
Df = N – 2 for standard correlations
Df = N – 3 for partial correlations
8
2
10
2
=
-
=
-
=
df
df
n
df
[
]
å
-
-
=
)
)(
(
Y
X
M
Y
M
X
SP
Y
X
SS
SS
[
]
Y
X
Y
X
Y
X
SS
SS
M
Y
M
X
SS
SS
SP
r
å
-
-
=
=
)
)(
(
18
.
0
265
.
962
000
.
169
600
.
925953
000
.
169
400
.
296
000
.
3124
000
.
169
-
=
-
=
-
=
´
-
=
=
Y
X
SS
SS
SP
r
384 From Decision Making to Association
Finally, scatter plot (d) shows a relationship that changes direction when a third vari- able is controlled. That is, the original positive association between X and Y becomes neg- ative within the two subgroups. That group 1 was so much greater than group 2 on both X and Y overshadowed the negative relationship within each subgroup. This type of situation occurs rarely in practice, but one still should be aware that an apparent finding could be just the opposite of what it should be.
All the comparisons we have considered thus far involve dichotomous (two-category) control variables. The same approach applies to control variables having three or more levels or categories. For example, one could investigate the influence of religion on the relationship between two variables by computing Pearson’s r separately for Protestants, Catholics, and Jews.
How would one handle an interval-level control variable like age? There is a tempta- tion to categorize age into a number of subgroups (for example, under 18, 18–34, 35–49, 50 and over) and then to plot the X–Y association separately for each age category. How- ever, this would be both inefficient and a waste of information (for example, the distinc- tion between 18-year-olds and 34-year-olds is lost because these two ages are within the
XX
Y
Y
Y
Y
XX
(a) Genuine relationship (b) Conditional relationship
(c) Spurious relationship (d) Changed relationship
Group 1 Group 2
FIGURE 10.8 Controlling for a third variable
M10_LEVI5484_12_SE_C10.indd 384 21/05/13 4:29 PM
.
22
11
XYXZYZ
XYZ
XZYZ
rrr
r
rr
-
=
--