Lecture 4: Correlation and Regression Laura McAvinue School of Psychology Trinity College Dublin.
Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression...
-
Upload
brian-elliott -
Category
Documents
-
view
234 -
download
1
Transcript of Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression...
![Page 2: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/2.jpg)
fourth lecture
We will learn in this lecture:
Correlation
and
Regression
1 -Linear Correlation Coefficient of Pearson
2 -Simple Linear Regression
![Page 3: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/3.jpg)
Definition of Correlation :
A correlation is a relationship between two variables. The data can be represented by the ordered pairs (x,y) where x is the independent (or explanatory) variable and y is the dependent (or response) variable.
![Page 4: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/4.jpg)
Example:
A. The relation exits between the number of hours for group of students spent studying for a test and their scores on that test.
B. The relation exits between the high outdoor temperature (in degrees Fahrenheit) and coffee sales (in hundreds of dollars) for a coffee shop for eight randomly selected days.
C. The relation exists between an individual’s weight (in pounds) and daily water consumption (in ounces).
D. The relation exists between income per year (in thousand of dollars) and a mount spent on milk per year (in dollars).
![Page 5: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/5.jpg)
x = hours spent studying , y= scores on that test
x = temperature (in degrees Fahrenheit) , y= coffee sales
x = an individual’s weight (in pounds) , y= water consumption
x = money spent on advertising , y= company sales
Example:
![Page 7: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/7.jpg)
x = hours spent studying
y= scores on that test
x= Income per yeary=a mount spent on milk
x=temperat-ure in degrees Fahrenheit y= coffee
sales
x= an individual’s weight (in pounds)
y= water consumption
![Page 8: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/8.jpg)
Linear Correlation Coefficient of Pearson
![Page 9: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/9.jpg)
The correlation coefficient is a measure of the strength and the direction of a liner relationship between two variables. The symbol r represents the sample correlation coefficient.
Where n is the number of pairs of data.
])(][)([ 2222 YYnXXn
YXXYnr
Definition of Correlation :
![Page 10: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/10.jpg)
Remark
The range of correlation coefficient is -1 to 1.
![Page 11: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/11.jpg)
r=1
0
5
10
15
20
25
30
35
40
45
0 2 4 6 8 10
x
yr=-1
0
5
10
15
20
25
30
35
40
45
50
0 2 4 6 8 10
x
y
r=-0.82
0
5
10
15
20
25
30
35
40
45
0 2 4 6 8 10
x
yr=0.88
0
10
20
30
40
50
60
0 2 4 6 8 10
x
y
r=0.2
0
1
2
3
4
5
6
7
8
0 2 4 6 8 10
x
yr=-0.3
0
1
2
3
4
5
6
0 2 4 6 8 10
x
y
r=0
00.5
11.5
22.5
33.5
44.5
0 1 2 3 4
x
y
Strong negative correlation
Strong positive correlation
Strong positive correlation
Weak positive
correlation
Weak negative
correlation
Strong negative correlation
Nocorrelation
![Page 12: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/12.jpg)
NoteWeak linear correlation coefficient does not mean no any relationship
x
y
876543210
75
70
65
60
55
50
S 3.51476R-Sq 89.5%R-Sq(adj) 85.3%
Fitted Line Ploty = 84.48 - 15.87 x
+ 1.768 x**2
![Page 13: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/13.jpg)
A marketing manager conducted a study to determine whether there is a linear relationship between money spent on advertising and company sales. The data are shown in the table below.
A. Calculate the correlation coefficient for the advertising expenditures and company sales data.
B. Display the data in a scatter plot then determine the types of correlation .
C. What can you conclude
2.2 2 1.6 1.4 2.6 2 1.6 2.4 Advertising expenses
215 186 184 180 240 220 184 225 Company sales
Example:
![Page 14: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/14.jpg)
X Y X2 Y2XY
2.4 225
1.6 184
2.0 220
2.6 240 6.76 57.600 624
1.4 180 1.96 32.400 252
1.6 184 2.56 33.856 294.4
2.0 186 4 34.596 372
2.2 215 4.84 46.225 473
Total 15.8 1634 32.44 337.558 3289.8
])(][)([ 2222 YYnXXn
YXXYnr
5.76
2.56
4
50.625
33.856
48.400
540
294.4
440
![Page 15: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/15.jpg)
])(][)([ 2222 YYnXXn
YXXYnr
X Y X2 Y2 XY
2.4 225 5.76 50.625 540
1.6 184 2.56 33.856 294.4
2.0 220 4 48.400 440
2.6 240 6.76 57.600 624
1.4 180 1.96 32.400 252
1.6 184 2.56 33.856 294.4
2.0 186 4 34.596 372
2.2 215 4.84 46.225 473
Total 15.8 1634 32.44 337.558 3289.8
2 2
8(3289.8) 15.8(1634)
[8(32.44) (15.8) ][8(337.558) (1634) ]r
=0.913
![Page 16: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/16.jpg)
Strong positive correlation
![Page 19: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/19.jpg)
Reg
ression
lin
e
The equation of a regression line
Independent variable
dependent variable(response)
![Page 20: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/20.jpg)
The equation of a regression line for an independent variable X and a dependent variable Y is:
where Y is the predicted Y-value for a given X-value. The slope m and Y-intercept b are given by:
and
where is the mean of the Y-value in the data set and is the mean of the X-value.
Y mX b
2 2( )
n XY X Ym
n X X
b Y mX
XY
![Page 21: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/21.jpg)
A marketing manager conducted a study to determine whether there is a linear relationship between money spent on advertising and company sales. The data are shown in the table below.
Find the equation of the regression line for the advertising expenditures and company sales data
2.2 2 1.6 1.4 2.6 2 1.6 2.4 Advertising expenses
215 186 184 180 240 220 184 225 Company sales
Example:
![Page 22: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/22.jpg)
2 2( )
n XY X Ym
n X X
b Y mX
X Y X2 Y2 XY
2.4 225 5.76 50.625 540
1.6 184 2.56 33.856 294.4
2.0 220 4 48.400 440
2.6 240 6.76 57.600 624
1.4 180 1.96 32.400 252
1.6 184 2.56 33.856 294.4
2.0 186 4 34.596 372
2.2 215 4.84 46.225 473
Total 15.8 1634 32.44 337.558 3289.8
![Page 23: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/23.jpg)
2
8(3289.9) 15.8(1634)
[8(32.44) (15.8) ]m
=50.7287
2 2( )
n XY X Ym
n X X
b Y mX 1634 15.8
50.7287( )8 8
b
=104.0608
Y=50.729X-104.061
X Y X2 Y2 XY
2.4 225 5.76 50.625 540
1.6 184 2.56 33.856 294.4
2.0 220 4 48.400 440
2.6 240 6.76 57.600 624
1.4 180 1.96 32.400 252
1.6 184 2.56 33.856 294.4
2.0 186 4 34.596 372
2.2 215 4.84 46.225 473
Total 15.8 1634 32.44 337.558 3289.8
![Page 24: Correlation and Regression. fourth lecture We will learn in this lecture: Correlation and Regression 1- Linear Correlation Coefficient of Pearson 2- Simple.](https://reader035.fdocuments.us/reader035/viewer/2022062313/56649f575503460f94c7c2c7/html5/thumbnails/24.jpg)
Reg
ression
lin
e
The equation of a regression line
Advertising expenses
Company sales