Scatterplots, Association, and Correlation Chapter 7.

Post on 15-Dec-2015

225 views 0 download

transcript

Scatterplots, Association,

and Correlation

Chapter 7

Slide 7 - 2

Looking at Scatterplots

• Scatterplots may be the most common and most effective display for data. o In a scatterplot, you can see patterns,

trends, relationships, and even the occasional extraordinary value sitting apart from the others.

• Scatterplots are the best way to start observing the relationship and the ideal way to picture associations between two quantitative variables.

Looking at Scatterplots

• Relationships between variables are often at the heart of what we’d like to learn from data:oDoes education level effect income?oDoes the cost of an athletic shoe indicate the

quality of the shoe?oDo students learn better with technology?

Slide 7 - 4

Looking at Scatterplots

• When looking at scatterplots, we will look for direction, form, strength, and unusual features.

• Direction:oA pattern that runs from the upper left to the

lower right is said to have a negative direction.

oA trend running the other way has a positive direction.

Slide 7 - 5

Looking at Scatterplots

• The figure shows a negative direction between the year since 1970 and the and the prediction errors made by NOAA.

• As the years have passed, the predictions have improved (errors have decreased).

Can the NOAA predict where a hurricane will go?

Direction• A pattern that runs from upper left to lower

right is said to be negative.

Direction• A pattern that runs from lower left to upper

right is said to be positive.

Slide 7 - 8

Looking at Scatterplots

• The example in the text shows a negative association between central pressure and maximum wind speed

• As the central pressure increases, the maximum wind speed decreases.

Slide 7 - 9

Form

If there is a straight line (linear) relationship, it will appear as a cloud or swarm of points stretched out in a generally consistent, straight form.

Slide 7 - 10

Form

If the relationship isn’t straight, but curves gently, while still increasing or decreasing steadily, we can often find ways to make it more nearly straight.

Slide 7 - 11

Form

o If the relationship curves sharply, the methods of this book cannot really

help us.

Slide 7 - 12

StrengthAt one extreme, the points appear to follow a single stream (whether straight, curved, or bending all over the place).

Slide 7 - 13

Strength

• At the other extreme, the points appear as a vague cloud with no discernible trend or pattern:

• Note: we will quantify the amount of scatter soon.

Slide 7 - 14

Unusual Features• Look for the unexpected.• Often the most interesting thing to see in a

scatterplot is the thing you never thought to look for.

• One example of such a surprise is an outlier standing away from the overall pattern of the scatterplot.

• Clusters or subgroups should also raise questions.o They may be a clue that you should split the

data into subgroups rather than looking at it all together.

What do you think the scatterplot would look like?

• Shoe size and grade point average?• The scatterplot is likely to be randomly scattered.• There is no association between shoe size and

grade point average.• Time for a mile run and age?• The very young will probably have very high

times. Older people will probably have very high times. Run times are likely to be lowest for people in their late teens and early twenties. The association is likely to be moderate and curved with no dominant direction.

• Drug dosage and pain relief?• The association is likely to be positive,

strong, and curved. Assuming that the drug is an effective pain reliever, the degree of pain relief is will increase. Eventually , the association is likely to level off until no further pain relief is possible since the pain is gone.

• Age of car and cost of repairs?• The association is positive, moderate, and

linear. As cars get older, they usually require more repairs.

Slide 7 - 17

Roles for Variables

• It is important to determine which of the two quantitative variables goes on the x-axis and which on the y-axis.

• This determination is made based on the roles played by the variables.

• When the roles are clear, the explanatory or predictor variable goes on the x-axis, and the response variable (variable of interest) goes on the y-axis.

Slide 7 - 18

Roles for Variables• The roles that we choose for variables are more

about how we think about them rather than about the variables themselves.

• Just placing a variable on the x-axis doesn’t necessarily mean that it explains or predicts anything. And the variable on the y-axis may not respond to it in any way.

Example• Suppose you were to collect data for each pair

of variables listed below. You want to make a scatterplot. Which variable would you use as the explanatory variable and which is the response variable? Why? Discuss the likely direction, form, and strength.

• A. When climbing a mountain: altitude, temperature

• Explanatory – altitude; Response – temperature• To predict temperature based on altitude.

Scatterplot: negative, possibly straight, moderate

• People: Age, grip strength• Explanatory – age; Response – grip strength• To predict grip strength based on age.

Scatterplot: curved down, moderate. Very young and elderly would have less grip strength than adults

• Drivers: blood alcohol level, reaction time• Explanatory – blood alcohol level; Response

– reaction time and other way around • To predict reaction time based on blood

alcohol level. Scatterplot: positive, nonlinear, moderately strong

Slide 7 - 21

• Data collected from students in Statistics classes included their heights (in inches) and weights (in pounds):

• Here we see a positive association and a fairly straight form, although there seems to be a high outlier.

Correlation

Slide 7 - 22

• How strong is the association between weight and height of Statistics students?

• If we had to put a number on the strength, we would not want it to depend on the units we used.

• A scatterplot of heights (in centimeters) and weights (in kilograms) doesn’t change the shape of the pattern:

Correlation

Slide 7 - 23

Correlation• Since the units don’t

matter, why not remove them altogether?

• We could standardize both variables and write the coordinates of a point as (zx, zy).

• Here is a scatterplot of the standardized weights and heights:

Slide 7 - 24

Correlation• Note that the underlying linear pattern seems

steeper in the standardized plot than in the original scatterplot.

• That’s because we made the scales of the axes the same.

• Equal scaling gives a neutral way of drawing the scatterplot and a fairer impression of the strength of the association.

Slide 7 - 25

Correlation• Some points (those in

green) strengthen the impression of a positive association between height and weight.

• Other points (those in red) tend to weaken the positive association.

• Points with z-scores of zero (those in blue) don’t vote either way.

Slide 7 - 26

Correlation• The correlation coefficient (r) gives us a

numerical measurement of the strength of the linear relationship between the explanatory and response variables.

r zxzyn 1

Slide 7 - 27

Correlation• For the students’ heights and weights, the

correlation is 0.644. • What does this mean in terms of strength? We’ll

address this shortly.

TI Directions • See directions on page 145 to enter points

for a scatterplot• Pass out example

Slide 7 - 29

Correlation Conditions

• Correlation measures the strength of the linear association between two quantitative variables.

• Before you use correlation, you must check several conditions:oQuantitative Variables Conditiono Straight Enough ConditionoOutlier Condition

Slide 7 - 30

Quantitative Variables Condition:

oCorrelation applies only to quantitative variables.

oDon’t apply correlation to categorical data masquerading as quantitative.

oCheck that you know the variables’ units and what they measure.

Slide 7 - 31

Straight Enough Condition:

• You can calculate a correlation coefficient for any pair of variables.

• But correlation measures the strength only of the linear association, and will be misleading if the relationship is not linear.

Slide 7 - 32

Outlier Condition:• Outliers can distort the correlation dramatically. • An outlier can make an otherwise small

correlation look big or hide a large correlation. • It can even give an otherwise positive

association a negative correlation coefficient (and vice versa).

• When you see an outlier, it’s often a good idea to report the correlations with and without the point.

Checkpoint exercise• Your statistics teacher tells you the correlation

between the scores on exam one and exam 2 was 0.75.

• Before answering any questions about the correlation, what would you like to see and how?

• Scores are quantitative. Check if the straight enough condition and outlier condition are satisfied by looking at scatterplots.

• If she adds 10 points to each exam one score, how will it change the correlation?

• It won’t change.• If she standardizes both scores how will

this affect the correlation?• It won’t change

• In general, if someone does poorly on exam 1, are they likely to do poorly or well on exam 2? Why?

• They are more likely to do poorly. The positive correlation means that low scores on exam 1 are associated with low scores on exam 2.

• If someone does poorly on exam 1, will they definitely do poorly on exam 2 as well?

• No. The general association is positive, but individual performances may vary.

Slide 7 - 36

Correlation Properties• The sign of a correlation coefficient gives the

direction of the association.• Correlation is always between –1 and +1.

oCorrelation can be exactly equal to –1 or +1, but these values are unusual in real data because they mean that all the data points fall exactly on a single straight line.

oA correlation near zero corresponds to a weak linear association.

Slide 7 - 37

Correlation Properties• Correlation treats x and y symmetrically:

o The correlation of x with y is the same as the correlation of y with x.

• Correlation has no units.• Correlation is not affected by changes in the

center or scale of either variable. oCorrelation depends only on the z-scores,

and they are unaffected by changes in center or scale.

Slide 7 - 38

Correlation Properties• Correlation measures the strength of the linear

association between the two variables. oVariables can have a strong association but

still have a small correlation if the association isn’t linear.

• Correlation is sensitive to outliers. A single outlying value can make a small correlation large or make a large one small.

How strong is strong?• There is NO agreement on characterizations

such as “weak”, “moderate” or “strong.” • To use these words adds a value judgment to

the to the numerical summary that correlation provides. What is weak in one context may be strong in another.

• Tell the correlation and show the scatterplot, others can judge for themselves.

Slide 7 - 40

Correlation ≠ Causation

• Whenever we have a strong correlation, it is tempting to explain it by imagining that the predictor variable has caused the response to help.

• Scatterplots and correlation coefficients never prove causation.

• A hidden variable that stands behind a relationship and determines it by simultaneously affecting the other two variables is called a lurking variable.

Slide 7 - 41

Correlation Tables• It is common in some fields to compute the

correlations between each pair of variables in a collection of variables and arrange these correlations in a table.

• Be careful with correlation tables!• Presenting the correlations without the

checks for linearity and outliers, the table risks showing truly small correlations have been inflated by outliers, truly large correlations that are hidden by outliers, and correlations of any size that may be meaningless because the form is not linear.

How to find the correlation

coefficient• Directions

p. 151

Year (Let 1990 = 0) Tuition in dollars

0 65461 69962 69963 73504 75005 79786 83777 87108 91109 941110 9800

Straightening Scatterplots P. 166 #35

• Create scatterplot and describe the association. (Direction, form, strength!)

• The association between position number of each planet and its distance from the sun is very strong, positive, and curved.

• Why would you not want to talk about the correlation between planet position and distance from the sun?

• It’s not linear. Correlation is a measure of the degree of linear association between two variables.

• Make a scatterplot showing the logarithm of the distance vs. position. What is better about this scatterplot?

• Log(L2)storL3

• Still shows a curve but it is straight enough that correlation may now be used.

p. 164• #19