Objectives (IPS Chapter 2.1) Scatterplots Scatterplots Explanatory and response variables ...

30
Objectives (IPS Chapter 2.1) Scatterplots Scatterplots Explanatory and response variables Interpreting scatterplots Outliers

Transcript of Objectives (IPS Chapter 2.1) Scatterplots Scatterplots Explanatory and response variables ...

Page 1: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Objectives (IPS Chapter 2.1)

Scatterplots

Scatterplots

Explanatory and response variables

Interpreting scatterplots

Outliers

Page 2: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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

Page 3: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Student Beers Blood Alcohol

1 5 0.1

2 2 0.03

3 9 0.19

6 7 0.095

7 3 0.07

9 3 0.02

11 4 0.07

13 5 0.085

4 8 0.12

5 3 0.04

8 5 0.06

10 5 0.05

12 6 0.1

14 7 0.09

15 1 0.01

16 4 0.05

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?

Association between 2 variables

Page 4: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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.

Association between 2 variables

Page 5: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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 ...

Association between 2 variables

Page 6: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Student Beers BAC

1 5 0.1

2 2 0.03

3 9 0.19

6 7 0.095

7 3 0.07

9 3 0.02

11 4 0.07

13 5 0.085

4 8 0.12

5 3 0.04

8 5 0.06

10 5 0.05

12 6 0.1

14 7 0.09

15 1 0.01

16 4 0.05

ScatterplotsIn a scatterplot, one axis is used to represent each of the variables,

and the data are plotted as points on the graph.

Page 7: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Explanatory (independent) variable: number of beers

Response

(dependent)

variable:

blood alcohol

content

xy

Explanatory and response variablesA 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.

Page 8: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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

Page 9: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Form and direction of an association

Linear

Nonlinear

No relationship

Page 10: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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

Page 11: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

One way to think about this is to remember the following: The equation for this line is y = 5.x is not involved.

No relationship: X and Y vary independently. Knowing X tells you nothing about Y.

Page 12: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Strength of the association

The strength of the relationship between the two variables can be

seen by how much variation, or scatter, there is around the main form.

With a strong relationship, you can get a pretty good estimate

of y if you know x.

With a weak relationship, for any x you might get a wide range of

y values.

Page 13: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

This is a very strong relationship.

The daily amount of gas consumed

can be predicted quite accurately for

a given temperature value.

This is a weak relationship. For a

particular state median household

income, you can’t predict the state

per capita income very well.

Strength of the relationship or association ...

Page 14: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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.

Page 15: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Objectives (IPS Chapter 2.2)

CorrelationThe correlation coefficient “r”

r does not distinguish between x and y

r has no units of measurement

r ranges from -1 to +1

Page 16: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

The correlation coefficient "r" The correlation coefficient is a measure of the direction and

strength of a linear relationship between two numerical

variables.

r ranges from -1 to +1.

The sign of r gives the direction of a scatter plot.

|r| gives the strength of a scatter plot:

If |r| is close to 1, then the strength is strong.

If |r| is close to 0.5, then the strength is moderate.

If |r| is close to 0, then the strength is weak.

Note: if r=1, then it is perfect positive; if r=-1, then it is

perfect negative.

Page 17: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Example to calculate “r” by handX 1 3 5

r=?Y 3 7 11

First, input all number into your calculator to get sample mean and

sample SD for X and Y respectively.

Second, write out the formula one by one:

a. first get the product of each z-score of x and z-score of y,

b. then sum them up,

c. finally to divide it by (n-1).

Page 18: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Part of the calculation involves finding z, the standardized score we used when working with the normal distribution.

You DON'T want to do this by hand. Make sure you learn how to use your calculator or software.

Page 19: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Example to calculate “r” by calculatorX 1 3 5

r=?Y 3 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…

Page 20: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Subject: STT215: TI 83 / 84, where's the correlation coefficient?

To find the correlation coefficient:

1. First, your calculator must be set up to display the correlation. (You only have to set it up once, so if you’ve done it in class, skip this part. Sometimes if you change batteries you have to do it again.) Hit 2nd CATALOG (this is over the 0 button).

2. Go down to DiagnosticOn, hit ENTER then ENTER again. It is now set up to display correlation with the regression line.

2. Enter the X values in one list and the Y values in another. Go to STAT>CALC 8:LinReg (a+bx) and hit ENTER. It is now pasted to the home screen. You must input the names of the list containing the X values followed by a comma then the list containing the Y values. For example, if my X values are in L1 and Y values are in L2, I would enter LinReg(a+bx) L1,L2

HWQ: 2.42 2.48 2.53 2.54

Page 21: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

How do I restore deleted lists on a TI-83 family or TI-84 Plus family graphing calculator? The instructions below detail how to restore deleted lists on a TI-83

family or TI-84 Plus family graphing calculator.

To restore the original list names (L1 - L6):

• Press [STAT]• Select 5:SetUpEditor

• Press [ENTER] (Done should appear on the screen)

The original lists, L1 - L6, should now appear when using [STAT] [ENTER].

Please see the TI-83 family and TI-84 Plus family guidebooks for additional information.

Page 22: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Examples for correlation coefficient “r”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.

X Y

1 3

3 5

4 7

6 9

U V

1 0

0 1

2 1

1 2

Page 23: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Examples for correlation coefficient “r”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

X Y

1 3

3 5

4 7

6 9

U V

1 0

0 1

2 1

1 2

EX2 scatter plot EX3 scatter plot EX4 scatter plot EX6 scatter plot

Page 24: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

“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

r = -0.75

Page 25: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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).

"r" has no unitr = -0.75

r = -0.75

z-score plot is the same for both plots

Page 26: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Correlation estimationEstimate the correlation coefficient from the scatter plot

Num of HB after Act

Num

of HB

353025201510

20.0

17.5

15.0

12.5

10.0

7.5

5.0

Scatterplot of Num of HB vs Num of HB after Act

r = -1 r = -0.95 r = -0.5 r = -0.25 r = -0.05

r = 0.05 r = 0.25 r = 0.5 r = 0.95 r = 1

Shoe Size

Foot

length

13121110987

29

28

27

26

25

24

23

22

21

20

Scatterplot of Foot length vs Shoe Size

height from Fto B

Heig

ht

1201101009080

200

190

180

170

160

150

Scatterplot of Height vs height from Fto B

R=0.861

R=0.393

R=0.778

Page 27: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

Correlation EstimationEstimate the correlation coefficient from the scatter plot

Year

100m

1990198019701960195019401930192019101900

11.0

10.8

10.6

10.4

10.2

10.0

Scatterplot of 100m vs Year

R= -1 R= -0.95 R= -0.5 R= -0.25 R= -0.05

R= 0.05 R= 0.25 R= 0.5 R= 0.95 R= 1

gpa

work

4.03.53.02.52.01.51.0

60

50

40

30

20

10

0

Scatterplot of work vs gpa

R= - 0.39R= - 0.9

Year

400m

1990198019701960195019401930192019101900

50

49

48

47

46

45

44

43

Scatterplot of 400m vs Year

R= - 0.951

Page 28: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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.

Correlation only describes linear relationships

Page 29: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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

HWQ: 2.28, 2.29 2.18

Summary #1:

Page 30: Objectives (IPS Chapter 2.1) Scatterplots  Scatterplots  Explanatory and response variables  Interpreting scatterplots  Outliers.

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

Summary #2: