Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2 Looking at Data— Relationships

Similar presentations


Presentation on theme: "Chapter 2 Looking at Data— Relationships"— Presentation transcript:

1 Chapter 2 Looking at Data— Relationships

2 Chapter 2 Looking at Data— Relationships
2.2 Scatterplots 2.3 Correlation

3 Key Characteristics of a Data Set
Certain characteristics of a data set are key to exploring the relationship between two variables. These should include the following: Cases: Identify the cases and how many there are in the data set. Label: Identify what is used as a label variable if one is present. Categorical or quantitative: Classify each variable as categorical or quantitative. Values: Identify the possible values for each variable. Explanatory or response: If appropriate, classify each variable as explanatory or response.

4 2.1 Relationships What is an association between variables?
Explanatory and response variables Key characteristics of a data set

5 Association between 2 variables
With 2 variables measured on the same individual, how could you describe the association? Our descriptions will depend upon the types of variables (categorical or quantitative): categorical vs. categorical - Examples? (smoke/lung cancer) categorical vs. quantitative - Examples? (Gender/height), (City / Income of a group of people) quantitative vs. quantitative - Examples? (Average working hours / Average GPA) A scatterplot is the best graph for showing relationships between two quantitative variables

6 Associations Between Variables
Many interesting examples of the use of statistics involve relationships between pairs of variables. 6 Two variables measured on the same cases are associated if knowing the value of one of the variables tells you something that you would not otherwise know about the value of the other variable. When you examine the relationship between two variables, a new question becomes important: Is your purpose simply to explore the nature of the relationship, or do you wish to show that one of the variables can explain variation in the other? A response variable measures an outcome of a study. An explanatory variable explains or causes changes in the response variable.

7 Association between 2 variables
Student Beers Blood Alcohol 1 5 0.1 2 0.03 3 9 0.19 6 7 0.095 0.07 0.02 11 4 13 0.085 8 0.12 0.04 0.06 10 0.05 12 14 0.09 15 0.01 16 Here, we have two quantitative variables for each of 16 students. 1) How many beers they drank, and 2) Their blood alcohol level (BAC) We are interested in the relationship between the two variables: How is one affected by changes in the other one?

8 Association between 2 variables
One common task is to show that one variable can be used to explain variation in the other. Explanatory variable vs. Response Variable Sometimes these are called independent(x) vs. dependent(y) variables. Eg: Here, we have two quantitative variables for each of 16 students. 1) How many beers they drank, and 2) Their blood alcohol level (BAC) But for some cases, it may be more reasonable to simply explore the relationship b/w two variables. Eg: High school math grades and high school English grades.

9 Association between 2 variables
These associations can be explored both graphically and numerically: begin your analysis with graphics find a pattern & look for deviations from the pattern look for a mathematical model to describe the pattern But again we do the above depending upon what type variables we have… we'll start with quantitative vs. quantitative ...

10 2.2 Scatterplots Scatterplots Interpreting scatterplots
Categorical variables in scatterplots

11 How to Make a Scatterplot
The most useful graph for displaying the relationship between two quantitative variables is a scatterplot. 11 A scatterplot shows the relationship between two quantitative variables measured on the same individuals. The values of one variable appear on the horizontal axis, and the values of the other variable appear on the vertical axis. Each individual corresponds to one point on the graph. How to Make a Scatterplot Decide which variable should go on each axis. If a distinction exists, plot the explanatory variable on the x axis and the response variable on the y axis. Label and scale your axes. Plot individual data values.

12 Scatterplot Example: Make a scatterplot of the relationship between body weight and backpack weight for a group of hikers. Body weight (lb) 120 187 109 103 131 165 158 116 Backpack weight (lb) 26 30 24 29 35 31 28

13 Scatterplots In a scatterplot, one axis is used to represent each of the variables, and the data are plotted as points on the graph. Student Beers BAC 1 5 0.1 2 0.03 3 9 0.19 6 7 0.095 0.07 0.02 11 4 13 0.085 8 0.12 0.04 0.06 10 0.05 12 14 0.09 15 0.01 16 Quantitative data - have two pieces of data per individual and wonder if there is an association between them. Very important in biology, as we not only want to describe individuals but also understand various things about them. Here for example we plot BAC vs number of beers. Can clearly see that there is a pattern to the data. When you drink more beers you generally have a higher BAC. Dots are arranged in pretty straight line - a linear relationship. And since when one goes up, the other does too, it is a positive linear relationship. Also see that

14 Explanatory and response variables
A response variable measures or records an outcome of a study. An explanatory variable explains changes in the response variable. Typically, the explanatory or independent variable is plotted on the x axis, and the response or dependent variable is plotted on the y axis. Explanatory (independent) variable: number of beers Response (dependent) variable: blood alcohol content x y An example of a study in which you are looking at the effects of number of beers on blood alcohol content. If you think about it, the response is obviously an increase in blood alcohol, and we want see if we can explain it by the number of beers drunk. Always put the explanatory variable on the x axis and response variable on the y axis.

15 Interpreting scatterplots
After plotting two variables on a scatterplot, we describe the relationship by examining the form, direction, and strength of the association. We look for an overall pattern … Form: linear, curved, clusters, no pattern Direction: positive, negative, no direction Strength: how closely the points fit the “form” … and deviations from that pattern. Outliers An example of a study in which you are looking at the effects of number of beers on blood alcohol content. If you think about it, the response is obviously an increase in blood alcohol, and we want see if we can explain it by the number of beers drunk. Always put the explanatory variable on the x axis and response variable on the y axis.

16 Form and direction of an association
Linear No relationship Nonlinear

17 The scatterplots below show perfect linear associations
Positive association: High values of one variable tend to occur together with high values of the other variable. Negative association: High values of one variable tend to occur together with low values of the other variable. The scatterplots below show perfect linear associations An example of a study in which you are looking at the effects of number of beers on blood alcohol content. If you think about it, the response is obviously an increase in blood alcohol, and we want see if we can explain it by the number of beers drunk. Always put the explanatory variable on the x axis and response variable on the y axis.

18 No relationship: X and Y vary independently
No relationship: X and Y vary independently. Knowing X tells you nothing about Y. One way to think about this is to remember the following: The equation for this line is y = 5. x is not involved.

19 Southern states are orange dots
Adding Categorical Variables Consider the relationship between mean SAT verbal score and percent of high school grads taking the SAT for each state. Southern states are orange dots To add a categorical variable, use a different plot color or symbol for each category.

20 Nonlinear Relationships
There are other forms of relationships besides linear. The scatterplot below is an example of a nonlinear form. Note that there is curvature in the relationship between x and y.

21 Outliers An outlier is a data value that has a very low probability of occurrence (i.e., it is unusual or unexpected). In a scatterplot, outliers are points that fall outside of the overall pattern of the relationship.

22 2.3 Correlation The correlation coefficient r Properties of r
Influential points

23 Correlation The correlation coefficient “r”
r does not distinguish between x and y r has no units of measurement r ranges from -1 to +1

24 Measuring Linear Association
We say a linear relationship is strong if the points lie close to a straight line and weak if they are widely scattered about a line. The following facts about r help us further interpret the strength of the linear relationship. Properties of Correlation r is always a number between –1 and 1. r > 0 indicates a positive association. r < 0 indicates a negative association. Values of r near 0 indicate a very weak linear relationship. The strength of the linear relationship increases as r moves away from 0 toward –1 or 1. The extreme values r = –1 and r = 1 occur only in the case of a perfect linear relationship.

25 Measuring Linear Association
A scatterplot displays the strength, direction, and form of the relationship between two quantitative variables. Linear relationships are important because a straight line is a simple pattern that is quite common. Our eyes are not always good judges of how strong a relationship is. Therefore, we use a numerical measure to supplement our scatterplot and help us interpret the strength of the linear relationship. The correlation r measures the strength of the linear relationship between two quantitative variables. Using the notation explained on pp. 103–104 in the text:

26 Correlation

27 Example to calculate “r” by hand
1 3 5 r=? Y 7 11 First, get sample mean and standard deviations for x and y respectively. Second, write out the formula one by one: first get the product of each z-score of x and z-score of y, then sum them up, finally to divide it by (n-1).

28 Example to calculate “r” by calculator
1 3 5 r=? Y 7 11 Input the data: Stat  Edit  Input X-values into L1; and input Y-values into L2. Calculate correlation coefficient r: Stat  Calc  option 4. If you can’t find r from your calculator, then you must follow the next slide to get the option of r back…

29 Examples for correlation coefficient “r”
X Y 1 3 3 5 4 7 6 9 Ex1. find the correlation coefficient of X and Y. Ex2. find the correlation coefficient of X and Z, where Z=2*X. Ex3. find the correlation coefficient of X and Z, where Z= -2*X. Ex4. find the correlation coefficient of X and Z, where Z= X+10. EX5. find the correlation coefficient of Y and X. EX6. find the correlation coefficient of U and V. Plot the scatter plots for EX2, EX3, EX4, and EX6 Now summarize all properties we obtain from these exercises. U V 1 0 0 1 2 1 1 2

30 Examples for correlation coefficient “r”
X Y 1 3 3 5 4 7 6 9 U V 1 0 0 1 2 1 1 2 Ex1. find the correlation coefficient of X and Y. Ex2. find the correlation coefficient of X and Z, where Z=2*X. Ex3. find the correlation coefficient of X and Z, where Z= -2*X. Ex4. find the correlation coefficient of X and Z, where Z= X+10. EX5. find the correlation coefficient of Y and X. EX6. find the correlation coefficient of U and V. Plot the scatter plots for EX2, EX3, EX4, and EX6 EX2 scatter plot EX3 scatter plot EX4 scatter plot EX6 scatter plot

31 “r” does not distinguish x & y
The correlation coefficient, r, treats x and y symmetrically. "Time to swim" is the explanatory variable here, and belongs on the x axis. However, in either plot r is the same (r=-0.75). r = -0.75

32 z-score plot is the same for both plots
"r" has no unit r = -0.75 Changing the units of variables does not change the correlation coefficient "r", because we get rid of all our units when we standardize (get z-scores). z-score plot is the same for both plots

33 Correlation only describes linear relationships
No matter how strong the association, r does not describe curved relationships. Note: You can sometimes transform a non-linear association to a linear form, for instance by taking the logarithm. You can then calculate a correlation using the transformed data.

34 Summary #1: The correlation coefficient, r, is a numerical measure of the strength and direction of the linear relationship between two quantitative/numerical variables. It is always a number between -1 and +1. Positive r positive association Negative r negative association r=+1 implies a perfect positive relationship; points falling exactly on a straight line with positive slope r=-1 implies a perfect negative relationship; points falling exactly on a straight line with negative slope r~0 implies a very weak linear relationship

35 Summary #2: Correlation makes no distinction between explanatory & response variables – doesn’t matter which is which… Both variables must be quantitative r uses standardized values of the observations, so changing scales of one or the other or both of the variables doesn’t affect the value of r. r measures the strength of the linear relationship between the two variables. It does not measure the strength of non-linear or curvilinear relationships, no matter how strong the relationship is… r is not resistant to outliers – be careful about using r in the presence of outliers on either variable


Download ppt "Chapter 2 Looking at Data— Relationships"

Similar presentations


Ads by Google