More Related Content
Similar to CH04 Covariance and Regression- Marketing Strategies (20)
CH04 Covariance and Regression- Marketing Strategies
- 4. Covariance
• Covariance measures the relationship
between two or more variables.
• We use the letter „r‟ to measure covariance.
• „r‟ can have the following values:
– „r‟ is always between -1 and +1
– When „r‟ is close to +1 we have a positive
covariance
– When „r‟ is close to -1 we have a negative
covariance
– When „r‟ is close to 0 we have a zero covariance
4
Copyright Osama Zaidiah 2013 ©
- 6. Covariance
• „r‟ can have the following values:
– „r‟ is always between -1 and +1
– When „r‟ is close to +1 we have a positive
covariance
– When „r‟ is close to -1 we have a negative
covariance
– When „r‟ is close to 0 we have a zero
covariance
6
Copyright Osama Zaidiah 2013 ©
- 7. How to measure Covariance?
• We have two measures for covariance:
– Pearson‟s Covariance Measure
– Spearman's Covariance Measure
7
Copyright Osama Zaidiah 2013 ©
- 10. Example: Pearson’s Covariance
• Since r is equal to
0.76, the relationship
is positive
x y x-x’ y-y’ 3 x 4
1 10 -2 -12 24
2 20 -1 -2 2
3 19 0 -3 0
4 26 1 4 4
5 35 2 13 26
56
76
.
0
6
.
73
56
2
.
9
6
.
1
5
56
2
.
9
,
6
.
1
56
)
)(
(
22
,
3
r
y
y
x
x
y
x
y
x
10
Copyright Osama Zaidiah 2013 ©
- 11. In Class Example: Pearson’s
Covariance
• Find the value of „r‟
for the attached
data.
x y x-x’ y-y’ 3 x 4
1 35
2 26
3 19
4 20
5 10
2
.
9
,
6
.
1
22
,
3
y
x
y
x
11
Copyright Osama Zaidiah 2013 ©
- 12. In Class Example: Pearson’s
Covariance
• Since r is equal to -
0.76, the relationship
is negative.
x y x-x’ y-y’ 3 x 4
1 35 -2 13 -26
2 26 -1 4 -4
3 19 0 -3 0
4 20 1 -2 -2
5 10 2 -12 -24
-56
76
.
0
6
.
73
56
2
.
9
6
.
1
5
56
2
.
9
,
6
.
1
56
)
)(
(
22
,
3
r
y
y
x
x
y
x
y
x
12
Copyright Osama Zaidiah 2013 ©
- 14. Spearman's Covariance Measure
• Use the formula:
• Where „d‟ is the difference of order
between the x and y points. (see
example)
)
1
(
6
1 2
2
n
n
d
rSpearman
14
Copyright Osama Zaidiah 2013 ©
- 15. Example: Spearman’s Covariance
• Since r is equal to
0.9, the relationship
is positive
x y Ox Oy d d2
1 10 5 5 0 0
2 20 4 3 1 1
3 19 3 4 -1 1
4 26 2 2 0 0
5 35 1 1 0 0
2
9
.
0
120
12
1
)
1
5
(
5
2
6
1
)
1
(
6
1
2
2
2
n
n
d
rSpearman
15
Copyright Osama Zaidiah 2013 ©
- 16. In Class Example: Spearman’s
Covariance
• Find the value of „r‟
for the attached
data.
x y Ox Oy d d2
1 35
2 26
3 19
4 20
5 10
16
Copyright Osama Zaidiah 2013 ©
- 17. In Class Example: Spearman’s
Covariance
x y Ox Oy d d2
1 35 5 1 4 16
2 26 4 2 2 4
3 19 3 4 -1 1
4 20 2 3 -1 1
5 10 1 5 -4 16
38
• Since r=-0.9 the
relationship is
negative
9
.
0
120
228
1
)
1
5
(
5
38
6
1
)
1
(
6
1
2
2
2
n
n
d
rSpearman
17
Copyright Osama Zaidiah 2013 ©
- 19. What is Regression?
• Regression is the process of fitting a
mathematical function to a set of data
points.
• In regression we seek to find the
relationship between two variables based
on data points we have.
19
Copyright Osama Zaidiah 2013 ©
- 21. Linear Regression: Two Methods
Linear
Regression
y(x) or y of x
y(x) or y of x
x(y) or x of y
x(y) or x of y
21
Copyright Osama Zaidiah 2013 ©
- 22. Linear Regression Equation: y(x)
• We can find the relationship between X
and Y:
• We call this the equation of y(x) “y of x”:
x
a
y
b
r
a
b
ax
y
x
y
22
Copyright Osama Zaidiah 2013 ©
- 23. Linear Regression Example: y(x)
5
.
2
5
.
2
)
(
:
5
.
2
3
5
.
2
10
)
2
(
5
.
2
6
.
1
5
8
.
0
)
1
(
:
8
.
0
6
.
1
,
3
/
5
0
x
b
ax
x
y
Then
x
a
y
b
r
a
Then
r
x
y
x
y
x
y /
,
1
:
n
informatio
following
the
have
you
If
23
Copyright Osama Zaidiah 2013 ©
- 24. Linear Regression Exercise: y(x)
b
ax
x
y
Find
r
x
y x
y
)
(
7
.
0
4
.
1
,
4
/
6
17
y(x).
of
Equation
Regression
Linear
the
/
,
:
n
informatio
following
the
have
you
If
24
Copyright Osama Zaidiah 2013 ©
- 25. Linear Regression Exercise: y(x)
14
5
3
3
5
3
)
(
5
4
3
17
)
2
(
3
4
.
1
6
7
.
0
)
1
(
3
7
.
0
4
.
1
,
4
/
6
17
y
x
x
x
y
b
a
x
y
Find
r
x
y x
y
then
3
If
when
of
value
the
/
,
:
n
informatio
following
the
have
you
If
25
Copyright Osama Zaidiah 2013 ©
- 26. Linear Regression: Two Methods
Linear
Regression
y(x) or y of x
y(x) or y of x
x(y) or x of y
x(y) or x of y
26
Copyright Osama Zaidiah 2013 ©
- 27. Linear Regression Equation: x(y)
• We can find the relationship between X
and Y:
• We call this the equation of y(x) “y of x”:
y
c
x
d
r
c
d
cy
x
y
x
27
Copyright Osama Zaidiah 2013 ©
- 28. Linear Regression Example: x(y)
6
.
5
26
.
0
)
(
:
6
.
5
10
26
.
0
3
)
2
(
26
.
0
5
6
.
1
8
.
0
)
1
(
:
8
.
0
6
.
1
,
3
/
5
0
y
d
cy
y
x
Then
y
c
x
d
r
c
Then
r
x
y
y
x
x
y /
,
1
:
n
informatio
following
the
have
you
If
28
Copyright Osama Zaidiah 2013 ©
- 29. Linear Regression Exercise: x(y)
d
cy
y
x
Find
y
x
find
r
x
y x
y
)
(
10
7
.
0
4
.
1
,
4
/
6
17
x(y).
of
Equation
Regression
Linear
the
if
/
,
:
n
informatio
following
the
have
you
If
29
Copyright Osama Zaidiah 2013 ©