Download presentation
Presentation is loading. Please wait.
2
Scatterplots, Association, and Correlation
Chapter 7 Scatterplots, Association, and Correlation Copyright © 2009 Pearson Education, Inc.
3
NOTE on slides / What we can and cannot do
The following notice accompanies these slides, which have been downloaded from the publisher’s Web site: “This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning. Dissemination or sale of any part of this work (including on the World Wide Web) will destroy the integrity of the work and is not permitted. The work and materials from this site should never be made available to students except by instructors using the accompanying text in their classes. All recipients of this work are expected to abide by these restrictions and to honor the intended pedagogical purposes and the needs of other instructors who rely on these materials.” We can use these slides because we are using the text for this course. Please help us stay legal. Do not distribute these slides any further. The original slides are done in orange / brown and black. My additions are in red and blue. Topics in green are optional.
4
Main topics in this chapter
Scatterplots Three things to look for Direction Form Strength Correlation and its properties Calculation Interpretation
5
Source: Introductory Statistics exam internet posting;
University of New Mexico
6
Negative, strong, linear
8
None at all!
10
Positive, linear, moderate except for two points
12
Negative, moderate. linear
14
Positive, moderate, not linear
15
Division of Mathematics, HCC Course Objectives for Chapter 7
After studying this chapter, the student will be able to: 24. Use a scatterplot to determine if a linear correlation is suggested between two variables and describe the correlation with regard to direction, form and scatter. 25. Compute the correlation of two variables and use it as part of the description of a scatterplot. 26. Identify and describe points that deviate from the overall pattern.
16
A change Up until now, we have been describing variables one at a time. We now turn toward describing the relationship between two quantitative variables. Statisticians call this bivariate data analysis. The main purpose of data analysis with two variables is to investigate whether there is an association and to describe that association (Source: Agresti & Franklin)
17
Correlation Let’s see what we already know about correlation (or association). Note the origin of the word: “co – relation” Let’s look at Exercise 6, page 186 of the text. Then let’s look at Exercise 4, page 173 of Jessica Utts’ book, “Seeing through Statistics.” These are the first four examples on the next slide.
18
Are each of the following pairs of variables likely to have a positive or negative correlation?
“Daily temperatures at noon in New York City and in Boston.” Weight of an automobile and its gas mileage in miles per gallon.” Hours of television watched and GPA of college students.” Years of education and salary.” (For HCC courses): How comfortable the chair in the classroom is and how well I like the course!
19
Response and Explanatory variables Source: Agresti & Franklin
Response variable (Dependent Variable) the outcome variable on which comparisons are made (Y) Explanatory (syn. Predictor) variable (Independent variable) defines the groups to be compared with respect to values on the response variable (X) Example: Response/Explanatory Blood alcohol level/# of beers consumed Grade on test/Amount of study time Yield of corn per bushel/Amount of rainfall
20
Sir Francis Galton (1822 – 1911) British biologist.
Half-cousin of Charles Darwin Invented the scatterplot. Also invented Standard Deviation (late 1860’s) Correlation (1888) First applied regression techniques to biological problems (genetics). Also studied fingerprints.
21
Historical Development of Correlation
Early papers: "Regression towards mediocrity in hereditary stature" (1885) "Family likeness in stature" (1886) "Co-relations and their measurement, chiefly from anthropometric data." (1888). The concept was formalized by Karl Pearson (1896) and Sir Ronald A. Fisher (1912). Source: Wikipedia
22
Looking at Scatterplots
Scatterplots may be the most common and most effective display for data. 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.
23
An Example – Chirping Crickets
Is there an association between the temperature and the number of times a cricket chirps in a minute? Do a scatterplot Sources: Pierce,, G., “The Song of Insects”, Harvard U Press Triola, M. “Elementary Statistics”, Pearson Temp (F) Chirps (/ min) 69.7 882 93.3 1188 84.3 1104 76.3 864 88.6 1200 82.6 1032 71.6 960 79.6 900
24
Scatterplot with the TI
Turn one plot on, make sure others are off and no Y1-Y6. Pick the upper left plot and make sure that you have the correct lists. Select [ZOOM], then 9
25
Scatterplot with the TI – a few things
If ZOOM 9 does not work, try [GRAPH]. If [GRAPH] does not work, set the windows manually. One possibility is shown below. TRACE does not work very well with a scatterplot.
29
Publisher’s Instructions
Scatter Plot : Displays pairs of numerical values (points) on typical Cartesian (perpendicular) axes. Select the column containing the X-values of the points. Select the column containing the Y-values of the points. Enter an optional Where clause to specify the data rows to be included in the computation. Select an optional Group by column to group results. By default if a Group by column is specified, a single scatter plot will be generated where the points are color-coded according to the distinct values of the Group by column. To create a separate scatter plot for each unique value of the Group by column, check the separate graph for each group option. Click the Next button to specify graph layout options. Click the Create Graph! button to create the plot(s).
30
Looking at Scatterplots (cont.)
When looking at scatterplots, we will look for direction, form, strength, and unusual features. Direction: A pattern that runs from the upper left to the lower right is said to have a negative direction. A trend running the other way has a positive direction.
31
Another Example A specific type of scatterplot
These represent SAT Math scores between 1996 and (I wanted a small dataset for the TI.) Enter these into L1 and L2.
32
Timeplot A timeplot is just like a scatterplot.
However, the time data are on the x-axis Timeplots are useful for looking at trends over time. We will return to this in Chapter 8.
33
Looking at Scatterplots (cont.)
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).
34
Looking at Scatterplots (cont.)
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.
35
Looking at Scatterplots (cont.)
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.
36
Looking at Scatterplots (cont.)
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.
37
Looking at Scatterplots (cont.)
Form: If the relationship curves sharply, the methods of this book cannot really help us.
38
Looking at Scatterplots (cont.)
Strength: At one extreme, the points appear to follow a single stream (whether straight, curved, or bending all over the place).
39
Looking at Scatterplots (cont.)
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.
40
Looking at Scatterplots (cont.)
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.
41
Published definition and example!
Internet: What’s wrong? Moral: Don’t believe everything you read!! What is this really?
42
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 goes on the y-axis.
43
Roles for Variables (cont.)
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.
44
Correlation 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.
45
Correlation (cont.) 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:
46
Correlation (cont.) 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:
47
Correlation (cont.) 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.
48
Correlation (cont.) Sir Francis Galton also invented scatterplots.
I was unable to find which concept was formalized first, correlation or scatter plots. However, it is natural that the same person would have discovered both! Both were first used to study inheritance of intelligence in humans. and later applied to the study of fingerprints.
49
Correlation (cont.) 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.
50
Correlation (cont.) The correlation coefficient (r) between X and Y gives us a numerical measurement of the strength of the linear relationship between the explanatory and response variables. (zx and zy denote the z-scores of X and Y respectively.)
51
Correlation (cont.) For the students’ heights and weights, the correlation is What does this mean in terms of strength? We’ll address this shortly.
52
Correlation (cont.) Let’s look at We can rewrite it as
This looks “sorta” like the formula for standard deviation Notice that both X and Y have been standardized. The denominator has to do with variation in X and Y separately. The numerator has to do with X and Y varying together.
53
Correlation by hand (from text p. 173)
54
Correlation by hand (using z-scores)
Slide 1- 54 54
55
Correlation Conditions
Correlation measures the strength of the linear association between two quantitative variables. Before you use correlation, you must check several conditions: Quantitative Variables Condition Straight Enough Condition Outlier Condition
56
Returning to the opening exercise
What is the correlation between the comfort level of the chair in the classroom and how well I like a course? Let’s grab the TI and figure it out! Can’t – what do we enter?
57
Correlation Conditions (cont.)
Quantitative Variables Condition: Correlation applies only to quantitative variables. Don’t apply correlation to categorical data masquerading as quantitative. Check that you know the variables’ units and what they measure.
58
Correlation Conditions (cont.)
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.
59
Correlation Conditions (cont.)
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 that point.
60
Correlation Properties
The sign of a correlation coefficient gives the direction of the association. Correlation is always between -1 and +1. Correlation 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. A correlation near zero corresponds to a weak linear association.
61
Correlation Properties (cont.)
Correlation treats x and y symmetrically: 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. Correlation depends only on the z-scores, and they are unaffected by changes in center or scale.
62
Correlation Properties (cont.)
Correlation measures the strength of the linear association between the two variables. Variables 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.
63
An Example – Chirping Crickets
Is there an association between the temperature and the number of times a cricket chirps in a minute? Do a scatterplot Compute r. Sources: Pierce,, G., “The Song of Insects”, Harvard U Press Triola, M. “Elementary Statistics”, Pearson Temp (F) Chirps (/ min) 69.7 882 93.3 1188 84.3 1104 76.3 864 88.6 1200 82.6 1032 71.6 960 79.6 900
64
TI – Before we start Select [2nd][CATALOG] Tab to “DiagnosticOn” Or
[ALPHA]D twice, then tab to “DiagnosticOn” Select. The TI will return “Done”. With 2.55, you can also use “statdiagnostics”
65
Correlation with the TI
Be sure that your data are entered (say in L1 and L2) Select [STAT][CALC] Select LinReg(ax+b) r = Rest of output is the subject of the next chapter.
66
Our Example – Chirping Crickets
We see the association with the scatterplot. We have computed r = Therefore, crickets chirping faster causes the temperature to rise! Any questions? (There should be!) Or does rising temperature cause crickets to chirp faster? Just from the numbers, we don’t know!
67
Correlation with StatCrunch
Select Stat Select Summary Stats. Select Correlation. Select both columns. No need to check the box about the p-value.
69
Correlation between Chirps and Temp_F is: 0.87367886
70
Publisher’s Instructions
Correlation : Computes the Pearson correlation between two columns or the lower half of the correlation matrix if three or more columns are selected. Select the columns to be used in the computation. Enter an optional Where clause to specify the data rows to be included in the computation. Select an optional Group By column to group results. A separate result (matrix) will be computed for each distinct value of the Group By column. Click the Calculate button to view the results.
71
**Scatterplot with EXCEL
Type the data as shown on the next slide. Cover all data with the mouse. Select Insert, then Scatter. The default graph is the one on the right. To get the one on the left, cluck directly on the numbers in the x axis and pick the min, max and width (major and minor axis) that you want. Do the same for the y axis.
75
Exam hint – reading the whole question
You may be given two sets of data in which you are asked to draw a scatterplot and / or give the correlation between them. This may be followed by other questions – such as regression (Chapter 8). The correlation comes as part of that output (we will see this in the next chapter.) The scatterplot can be requested then as well (with StatCrunch) Wait and do it all at once.
76
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. With the cricket example, we may have intuition, but by the numbers, we do not know what caused what! Other things can happen too. A hidden variable that stands behind a relationship and determines it by simultaneously affecting the other two variables is called a lurking variable.
77
Another questionable example.
The following chart shows the number of churches in a residential community in a given year and the number of burglaries reported to police (contrived data). The correlation is 0.992! Hmmmmm! Year Churches Burglaries 1960 2 121 1965 3 209 1970 5 311 1975 325 1980 6 355 1985 8 412 1990 467 1995 10 521 2000 12 640 2005 14 701
78
Another questionable example.
Are people burglarizing homes while people are in church? Most burglaries are occurring during midweek and early Saturday and Sunday morning (1 AM – 3 AM). There are no church services then. What’s happening! Look at the population of the community. It has grown at about the same rate as the number of burglaries. Churches were built to keep up with the population! Population is a lurking variable.
79
Lurking Variables & Confounding (Source: Agresti & Franklin)
A lurking variable is a variable, usually unobserved, that influences the association between the variables of primary interest Ice cream sales and drowning – lurking variable =temperature Reading level and shoe size – lurking variable=age Childhood obesity rate and GDP-lurking variable=time When two explanatory variables are both associated with a response variable but are also associated with each other, there is said to be confounding Lurking variables are not measured in the study but have the potential for confounding
80
Goofy Correlations The next five slides are taken from “Bundled Babies: Dangerous Ice Cream” by Kathleen H. Offenholley, “Mathematics Teacher”, Vol. 106, No. 6, February 2013, pp. 418 – 422 Does correlation imply causation or is there something else going on?
81
Goofy Correlation #1 Fire Damage and Fire Trucks
“The amount of damage at the scene of a fire has a positive correlation with the number of fire trucks at the scene.” More people will call 911 when the fire is more extensive. When 911 dispatchers get more calls, more alarms are sent out. Fire trucks will respond to each alarm.
82
Goofy Correlation #2 Bundled-Up Babies and Outdoor Temperature
“The age at which a baby first learns to crawl has a negative correlation with the outdoor temperature.” If the temperature goes down, babies have to be bundled in layers of winter clothing to go out. This inhibits their ability to crawl.
83
Goofy Correlation #3 Dangerous Ice Cream and Drownings
“The number of ice cream servings consumed has a positive correlation with the number of drownings.” As the outdoor temperature goes up, more ice cream is eaten. As the outdoor temperature goes up, there are more drownings.
84
Goofy Correlation #4 Car cost and Gas mileage
“In 2005, there was a negative correlation between car cost and gas mileage.” Typically, cars with larger engines tend to cost more. Cars with larger engines also get lower gas mileage. With the recent advent of hybrid vehicles, this correlation may no longer hold.
85
Goofy Correlation #5 Foot size and reading ability
“Foot size and reading ability have a positive correlation.” Older children have bigger feet. Older children also have better reading ability.
86
One more thing (TI) Correlation between chirps and temp in Celsius
Enter formula as shown; result in L3. Perform same steps before (L3 instead of L2). Did the correlation change?
87
We can see that Changes with Shifting? Changes with Rescaling? Units
Mean Yes Yes (unless you rescale around the mean). Same as data Standard Deviation No Correlation None
88
Correlation Tables It is common in some fields to compute the correlations between every pair of variables in a collection of variables and arrange these correlations in a table.
89
Straightening Scatterplots
Correlation is a measure of the strength for straight relationships only. Therefore, straight line relationships are the ones that we can measure with correlation. When a scatterplot shows a bent form that consistently increases or decreases, we can often straighten the form of the plot by re-expressing one or both variables. We can often find transformations that straighten the scatterplot’s form. Later in the text, we discuss simple ways to find a good re-expression.
90
*Straightening Scatterplots (cont.) (from 2nd edition)
A scatterplot of f/stop vs. shutter speed shows a bent relationship:
91
*Straightening Scatterplots (cont.) (from 2nd edition)
Re-expressing f/stop speed by squaring straightens the relationship:
92
What Can Go Wrong? Don’t say “correlation” when you mean “association.” More often than not, people say correlation when they mean association. The word “correlation” should be reserved for measuring the strength and direction of the linear relationship between two quantitative variables.
93
What Can Go Wrong? Don’t confuse “correlation” with “causation.”
Scatterplots and correlations never demonstrate causation. These statistical tools can only demonstrate an association between variables.
94
What Can Go Wrong? (cont.)
Don’t correlate categorical variables. Be sure to check the Quantitative Variables Condition. Be sure the association is linear. There may be a strong association between two variables that have a nonlinear association.
95
Correlation versus relationship
If you compute the correlation between these two variables, what you will get is 0, But there is clearly a relationship:
96
What Can Go Wrong? (cont.)
Don’t assume the relationship is linear just because the correlation coefficient is high. Here the correlation is 0.979, but the relationship is actually bent.
97
What Can Go Wrong? (cont.)
Beware of outliers. Even a single outlier can dominate the correlation value. Make sure to check the Outlier Condition.
98
For example Recall that the correlation of these points is 0.
I added the point (100, 100) to the 84 points on this graph. The correlation rose to 0.994! Had I added (100, -100), the correlation would have been This is extreme, but it illustrates the point.
99
What Can Go Wrong? (cont.)
Watch out for lurking variables. A hidden variable that stands behind a relationship and determines it by simultaneously affecting the other two variables is called a lurking variable. Example: Experiment on activity of mice. Example: Churches and burglaries. Example: Number of firefighters and cost of fire. Example: pp. 325 off – Impact of musical instrument playing on school GPA.
100
What have we learned? We examine scatterplots for direction, form, strength, and unusual features. Although not every relationship is linear, when the scatterplot is straight enough, the correlation coefficient is a useful numerical summary. The sign of the correlation tells us the direction of the association. The magnitude of the correlation tells us the strength of a linear association. Correlation has no units, so shifting or scaling the data, standardizing, or swapping the variables has no effect on the numerical value.
101
What have we learned? (cont.)
Doing Statistics right means that we have to Think about whether our choice of methods is appropriate. Before finding or talking about a correlation, check the Straight Enough Condition. Watch out for outliers! Don’t assume that a high correlation or strong association is evidence of a cause-and-effect relationship—beware of lurking variables!
102
Main topics in this chapter
Scatterplots Three things to look for Direction Form Strength Correlation and its properties Calculation Interpretation
103
Division of Mathematics, HCC Course Objectives for Chapter 7
After studying this chapter, the student will be able to: 24. Use a scatterplot to determine if a linear correlation is suggested between two variables and describe the correlation with regard to direction, form and scatter. 25. Compute the correlation of two variables and use it as part of the description of a scatterplot. 26. Identify and describe points that deviate from the overall pattern.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.