Академический Документы
Профессиональный Документы
Культура Документы
opasdfghjklzxcvbnmqwertyuiopasdfgh
jklzxcvbnmqwertyuiopasdfghjklzxcvb
nmqwertyuiopasdfghjklzxcvbnmqwer
Assignment No 1
(After Mids)
tyuiopasdfghjklzxcvbnmqwertyuiopas
Regression & Correlation
dfghjklzxcvbnmqwertyuiopasdfghjklzx
Submitted By
Muhammad Awais
cvbnmqwertyuiopasdfghjklzxcvbnmq
[Sys ID: NUML-S20-11149]
wertyuiopasdfghjklzxcvbnmqwertyuio
Submitted To
Mam Rabia Azeem
pasdfghjklzxcvbnmqwertyuiopasdfghj
Subject
BMS
klzxcvbnmqwertyuiopasdfghjklzxcvbn
BBA 2 Years 1ST Semester (Morning)
mqwertyuiopasdfghjklzxcvbnmqwerty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
vbnmqwertyuiopasdfghjklzxcvbnmrty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
Regression Questions
Q No 1
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒕𝒑 − (∑ 𝒕) (∑ 𝒑)
𝒃=
𝒏(∑ 𝒕𝟐 ) − (∑ 𝒕)𝟐
̅ − 𝒃𝒕̅
𝒂=𝒑
∑𝒑
̅=
𝒑
𝒏
∑𝒕
𝒕̅ =
𝒏
p t t2 tp
3 1 1 3
8 3 9 24
30 9 81 270
25 10 100 250
15 5 25 75
12 6 36 72
∑ 𝒑 = 𝟗𝟑 ∑ 𝒕 = 𝟑𝟒 ∑ 𝒕𝟐 = 𝟐𝟓𝟐 ∑ 𝒕𝒑 = 𝟔𝟗𝟒
(a)
𝒏 ∑ 𝒕𝒑 − (∑ 𝒕) (∑ 𝒑)
𝒃=
𝒏(∑ 𝒕𝟐 ) − (∑ 𝒕)𝟐
6(694) − (34)(93)
𝑏=
6(252) − (34)2
4164 − 3162
𝑏=
1512 − 1156
1002
𝑏=
356
𝒃 = 𝟐. 𝟖𝟏
̅ − 𝒃𝒕̅
𝒂=𝒑
∑𝒑
̅=
𝒑
𝒏
93
𝑝̅ =
6
̅ = 𝟏𝟓. 𝟓
𝒑
∑𝒕
𝒕̅ =
𝒏
34
𝑡̅ =
6
𝒕̅ = 𝟓. 𝟔
̅ − 𝒃𝒕̅
𝒂=𝒑
𝑎 = 15.5 − 2.81(5.6)
𝑎 = 15.5 − 15.9
𝒂 = −𝒐. 𝟒
𝒑 = 𝒂 + 𝒃𝒕
𝒑 = −𝟎. 𝟒 + 𝟐. 𝟖𝟏𝒕
(b)
If t = 15
𝑝 = −0.4 + 2.81𝑡
𝑝 = −0.4 + 2.81(15)
𝑝 = −0.4 + 42.15
𝒑 = 𝟒𝟏. 𝟕𝟓
(c)
If there is one unit increase in the value of t there is 2.8 times
increase in the value of p.
Q No 2
Solution:
∑𝒑
̅=
𝒑
𝒏
∑𝒕
𝒕̅ =
𝒏
p t t2 tp
98 42 1764 4116
130 74 5476 9620
120 48 2304 5760
88 35 1225 3080
182 56 3136 10192
80 26 676 2080
135 60 3600 8100
(a)
𝒏 ∑ 𝒕𝒑 − (∑ 𝒕) (∑ 𝒑)
𝒃=
𝒏(∑ 𝒕𝟐 ) − (∑ 𝒕)𝟐
7(42948) − (341)(833)
𝑏=
7(18181) − (341)2
300636 − 284053
𝑏=
127267 − 116281
16583
𝑏=
10986
𝒃 = 𝟏. 𝟓𝟎
̅ − 𝒃𝒕̅
𝒂=𝒑
∑𝒑
̅=
𝒑
𝒏
833
𝑝̅ =
7
̅ = 𝟏𝟏𝟗
𝒑
∑𝒕
𝒕̅ =
𝒏
341
𝑡̅ =
7
𝒕̅ = 𝟒𝟖. 𝟕𝟏
̅ − 𝒃𝒕̅
𝒂=𝒑
𝑎 = 119 − 1.50(48.71)
𝑎 = 119 − 73.06
𝒂 = 𝟒𝟓. 𝟗𝟒
𝒑 = 𝒂 + 𝒃𝒕
𝒑 = 𝟒𝟓. 𝟗𝟒 + 𝟏. 𝟓𝟎𝒕
(b)
If t = 80
𝑝 = 45.94 + 1.50𝑡
𝑝 = 45.94 + 1.50(80)
𝑝 = 45.94 + 120
𝒑 = 𝟏𝟔𝟓. 𝟗𝟒
(c)
If there is one unit increase in the value of t there is 1.50 times increase
in the value of p.
Q No 3
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝒚
̅=
𝒚
𝒏
∑𝒙
̅=
𝒙
𝒏
X Y X2 xy
2 22 4 44
2.5 34 6.25 85
3 33 9 99
4 37 16 148
4.5 40 20.25 180
4.5 45 20.25 202.5
5 49 25 196
3 30 9 90
6 58 36 348
6.5 58 42.25 377
(a)
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
10(1769.5) − (41)(406)
𝑏=
10(188) − (41)2
17695 − 16646
𝑏=
1880 − 1681
1049
𝑏=
199
𝒃 = 𝟓. 𝟐𝟕
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝑦
𝑦̅ =
𝑛
406
𝑦̅ =
10
̅ = 𝟒𝟎. 𝟔
𝒚
∑𝑥
𝑥̅ =
𝑛
41
𝑥̅ =
10
̅ = 𝟒. 𝟏
𝒙
̅ − 𝒃𝒙
𝒂=𝒚 ̅
𝑎 = 40.6 − 5.27(4.1)
𝑎 = 40.6 − 21.6
𝒂 = 𝟏𝟗
𝒚 = 𝒂 + 𝒃𝒙
So our regression line is:
𝒚 = 𝟏𝟗 + 𝟓. 𝟐𝟕𝒙
(b)
If x = 10
𝑦 = 19 + 5.27𝑥
𝑦 = 19 + 5.27(10)
𝑦 = 19 + 52.7
𝒚 = 𝟕𝟏. 𝟕
(c)
If there is one unit increase in the value of x there is 5.27 times increase
in the value of y.
Q No 4
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝒚
̅=
𝒚
𝒏
∑𝒙
̅=
𝒙
𝒏
X Y X2 xy
10 35 100 350
20 55 400 1100
30 40 900 1200
35 100 1225 3500
40 60 1600 2400
50 90 2500 4500
60 110 3600 6600
70 130 4900 9100
(a)
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
8(28750) − (315)(620)
𝑏=
8(15225) − (315)2
230000 − 195300
𝑏=
121800 − 99225
34700
𝑏=
22575
𝒃 = 𝟏. 𝟓
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝑦
𝑦̅ =
𝑛
620
𝑦̅ =
8
̅ = 𝟕𝟕. 𝟓
𝒚
∑𝑥
𝑥̅ =
𝑛
315
𝑥̅ =
8
̅ = 𝟑𝟗. 𝟒
𝒙
𝑎 = 𝑦̅ − 𝑏𝑥̅
𝑎 = 77.5 − 1.5(39.4)
𝑎 = 77.5 − 59.1
𝒂 = 𝟏𝟖. 𝟒
𝒀 = 𝒂 + 𝒃𝑿
𝒀 = 𝟏𝟖. 𝟒 + 𝟏. 𝟓𝑿
(b)
If X = 100
𝑌 = 18.4 + 1.5𝑋
𝑌 = 18.4 + 1.5(100)
𝑌 = 18.4 + 150
𝒚 = 𝟏𝟔𝟖. 𝟒
(c)
If there is one unit increase in the value of x there is 1.5 times increase
in the value of y.
Correlation Questions
Q No 1
Solution:
The formulas to find out the a and b use as follows
Correlation Formula:
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
Correlation
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
10(1116) − (75)(170)
𝑟=
√[10(645) − (75)2 ][10(3212) − (170)2 ]
11160 − 12750
𝑟=
√[6450 − 5625][32120 − 28900]
−1590
𝑟=
√[825][3220]
−1590
𝑟=
√2656500
−1590
𝑟=
1629.877
𝒓 = −𝒐. 𝟗𝟕55
As we see the result r=-0.9755 means there is a strong negative
correlation between two variables.
Regression Line
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
10(1116) − (75)(170)
𝒃=
10(645) − (75)2
11160 − 12750
𝒃=
6450 − 5625
−1590
𝒃=
825
−1590
𝒃=
825
𝒃 = −𝟏. 𝟗𝟐𝟕
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝑦
𝑦̅ =
𝑛
170
𝑦̅ =
10
̅ = 𝟏𝟕
𝒚
∑𝑥
𝑥̅ =
𝑛
75
𝑥̅ =
10
̅ = 𝟕. 𝟓
𝒙
̅ − 𝒃𝒙
𝒂=𝒚 ̅
𝒂 = 𝟏𝟕 + 𝟏. 𝟗𝟐𝟕(𝟕. 𝟓)
𝒂 = 𝟏𝟕 + 𝟏𝟒. 𝟒𝟓
𝒂 = 𝟑𝟏. 𝟒𝟓
𝒀 = 𝒂 + 𝒃𝑿
So our regression line is:
𝒀 = 𝟑𝟏. 𝟒𝟓 − 𝟏. 𝟗𝟐𝟕𝑿
Q No 2 (a)
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
X Y X2 Y2 xy
5 11 25 121 55
12 16 144 256 192
14 15 196 225 210
16 20 256 400 320
18 17 324 289 306
21 19 441 361 399
22 25 484 625 550
23 24 529 576 552
25 21 625 441 525
∑ 𝒙 = 𝟏𝟓𝟔 ∑ 𝒚 = 𝟏𝟔𝟖 ∑ 𝒙𝟐 = 𝟑𝟎𝟐𝟒 ∑ 𝒚𝟐 = 𝟑𝟐𝟗𝟒 ∑ 𝒙𝒚 = 𝟑𝟏𝟎𝟗
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
9(3109) − (156)(168)
𝑟=
√[9(3024) − (156)2 ][9(3294) − (168)2 ]
27981 − 26208
𝑟=
√[27216 − 24336][29646 − 28224]
1773
𝑟=
√[2880][1422]
1773
𝑟=
√4095360
1773
𝑟=
2023.699
𝒓 = 𝟎. 𝟖𝟕𝟔
As we see the result r=0.876 means there is a strong positive
correlation between two variables.
Q No 2 (b)
Solution:
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
X Y X2 Y2 xy
137 23 18769 529 3151
209 47 43681 2209 9823
113 22 12769 484 2486
189 40 35721 1600 7560
176 39 30976 1521 6864
200 51 40000 2601 10200
219 49 47961 2401 10731
∑ 𝒙 = 𝟏𝟐𝟒𝟑 ∑ 𝒚 = 𝟐𝟕𝟏 ∑ 𝒙𝟐 = 𝟐𝟐𝟗𝟖𝟕𝟕 ∑ 𝒚𝟐 = 𝟏𝟏𝟑𝟒𝟓 ∑ 𝒙𝒚 = 𝟓𝟎𝟖𝟏𝟓
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
7(50815) − (1243)(271)
𝑟=
√[7(229877) − (1243)2 ][7(11345) − (271)2 ]
355705 − 336853
𝑟=
√[1609139 − 1545049][79415 − 73441]
18852
𝑟=
√[64090][5974]
18852
𝑟=
√382873660
18852
𝑟=
19567.15769
𝒓 = 𝟎. 𝟗𝟔𝟑
As we see the result r=0.963 means there is a strong positive
correlation between two variables.
Extra 3 Questions
Q No 1
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝒚
̅=
𝒚
𝒏
∑𝒙
̅=
𝒙
𝒏
X Y X2 xy
0 2 0 0
1 3 1 3
2 5 4 10
3 4 9 12
4 6 16 24
∑ 𝒙 = 𝟏𝟎 ∑ 𝒚 = 𝟐𝟎 ∑ 𝒙𝟐 = 𝟑𝟎 ∑ 𝒙𝒚 = 𝟒𝟗
(a)
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
5(49) − (10)(20)
𝑏=
5(30) − (10)2
245 − 200
𝑏=
150 − 100
45
𝑏=
50
𝒃 = 𝟎. 𝟗
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝑦
𝑦̅ =
𝑛
20
𝑦̅ =
5
̅=𝟒
𝒚
∑𝑥
𝑥̅ =
𝑛
10
𝑥̅ =
5
̅=𝟐
𝒙
𝑎 = 𝑦̅ − 𝑏𝑥̅
𝑎 = 4 − 0.9(2)
𝑎 = 4 − 1.8
𝒂 = 𝟐. 𝟐
𝒀 = 𝒂 + 𝒃𝑿
𝒚 = 𝟐. 𝟐 + 𝟎. 𝟗𝑿
(b)
If X = 10
𝑌 = 2.2 + 0.9𝑋
𝑌 = 2.2 + 0.9(10)
𝑌 = 2.2 + 9
𝒚 = 𝟏𝟏. 𝟐
Q No 2
The values of x and the values of corresponding y are given in table
below:
x 43 21 25 42 57 59
y 99 65 79 75 87 81
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝒚
̅=
𝒚
𝒏
∑𝒙
̅=
𝒙
𝒏
X Y X2 xy
43 99 1849 4257
21 65 441 1365
25 79 625 1975
42 75 1764 3150
57 87 3249 4959
59 81 3481 4779
∑ 𝒙 = 𝟐𝟒𝟕 ∑ 𝒚 = 𝟒𝟖𝟔 ∑ 𝒙𝟐 = 𝟏𝟏𝟒𝟎𝟗 ∑ 𝒙𝒚 = 𝟐𝟎𝟒𝟖𝟓
(a)
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒃=
𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐
6(20485) − (247)(486)
𝑏=
6(11409) − (247)2
122910 − 120042
𝑏=
68454 − 61009
2868
𝑏=
7445
𝒃 = 𝟎. 𝟑𝟖
̅ − 𝒃𝒙
𝒂=𝒚 ̅
∑𝑦
𝑦̅ =
𝑛
486
𝑦̅ =
6
̅ = 𝟖𝟏
𝒚
∑𝑥
𝑥̅ =
𝑛
247
𝑥̅ =
6
̅
𝒙 = 𝟒𝟏. 𝟏𝟔𝟔
̅ − 𝒃𝒙
𝒂=𝒚 ̅
𝑎 = 81 − 0.38(41.166)
𝑎 = 81 − 15.6
𝒂 = 𝟔𝟓. 𝟒
𝒀 = 𝒂 + 𝒃𝑿
𝒚 = 𝟔𝟓. 𝟒 + 𝟎. 𝟑𝟖𝑿
(b)
If X = 25
𝑦 = 65.4 + 0.38𝑋
𝑦 = 65.4 + 0.38(25)
𝑦 = 65.4 + 9.5
𝒚 = 𝟕𝟒. 𝟗
Q No 3
A football fan wishes to see how the number of pass attempts relates to the
number of yards gained for quarter bags in past NFL season playoff games. The
data are shown for 5 quarter describes the relationship.
Solution:
The formulas to find out the a and b use as follows
𝒏 ∑ 𝒙𝒚 − (∑ 𝒙) (∑ 𝒚)
𝒓=
√[𝒏(∑ 𝒙𝟐 ) − (∑ 𝒙)𝟐 ][𝒏(∑ 𝒚𝟐 ) − (∑ 𝒚)𝟐 ]
X Y X2 Y2 xy
116 1001 13456 1002001 116116
90 823 8100 677329 74070
82 851 6724 724201 69782
108 873 11664 762129 94284
92 839 8464 703921 77188
∑ 𝒙 = 𝟒𝟖𝟖 ∑ 𝒚 = 𝟒𝟑𝟖𝟕 ∑ 𝒙𝟐 = 𝟒𝟖𝟒𝟎𝟖 ∑ 𝒚𝟐 = 𝟑𝟖𝟔𝟗𝟓𝟖𝟏 ∑ 𝒙𝒚 = 𝟒𝟑𝟏𝟒𝟒𝟎
𝑛 ∑ 𝑥𝑦 − (∑ 𝑥) (∑ 𝑦)
𝑟=
√[𝑛(∑ 𝑥 2 ) − (∑ 𝑥)2 ][𝑛(∑ 𝑦 2 ) − (∑ 𝑦)2 ]
5(431440) − (488)(4387)
𝑟=
√[5(48408) − (488)2 ][5(3869581) − (4387)2 ]
2157200 − 2140856
𝑟=
√[242040 − 238144][19347905 − 19245769]
16344
𝑟=
√[3896][102136]
16344
𝑟=
√397921856
16344
𝑟=
19947.97874
𝒓 = 𝟎. 𝟖𝟏𝟗
As we see the result r=0.876 means there is a strong positive
correlation between two variables.
Examples
Examples of Correlation
Here are the following examples of correlations:
Positive Correlation
1. The more time you spend on a project, the more effort you’ll have to put in.
2. The more money you make, the more taxes the government takes out of
your check.
3. The more overtime you work, the more money you’ll earn.
Negative Correlation
1. The more you work in the office, the less time you'll spend at home.
2. The more employees you hire, the fewer funds you'll have.
Examples of Regression
Here are the following examples of regression:
1. Estimate the relationship between the stock market index and its
relationship with the macro economic variables.
2. Examining the exchange rate movement and its dependency on several key
macro economic factors.
3. Verifying the relationship between house pricing vs a whole bunch of
exogenous variables such as neighborhood, location, bathrooms in the
house, bedrooms, how far is it from the city.