Professional Documents
Culture Documents
Lecture 2
Lecture 2
Variance
The average of the squared differences from the mean
2
( x ) ( x x ) 2
2 s2
N n 1
Standard deviation
The square root of the Variance
( x ) 2
2 ( x x ) 2
s 2
s
N n 1
Measures of Dispersion:
Population Variance and Standard Deviation
Example
You grow 5 carrots in your backyard and
measure the length of each carrot in
centimeters. Here is your data:
9 7 5 4 12
x = 7.4
N
Measures of Dispersion:
Population Variance and Standard Deviation
Solution
( x ) 2
2
Mean = 7.4 N
x x – ̅ ሺ࢞ െ࢞ഥሻ
12
18
7
10
( x x ) 2
s2
n 1
Measures of Dispersion:
Sample Variance and Standard Deviation 2
( x x )
Solution s2
n 1
n= 4 𝒙
x x – ̅ ሺ࢞ െ࢞ഥሻ
12 0.25 0.0625 n-1 𝒙 3
18 6.25 39.0625 mean 11.7500
7 -4.75 22.5625 Σ(x – ̅) 0
10 -1.75 3.0625 Σ ሺ࢞ െ࢞ഥሻ 64.7500
Σ ሺ࢞ െ࢞ഥሻ/n-1 21.583
Variance = 21.583
Std 4.646
Range = 18-7 =11
Unit 2
Correlation
Correlation is an association or relationship
between two quantitative variables [NOTE:
Correlation is not (does not imply) causation!!!]
The local ice cream shop keeps track of how much ice cream
they sell versus the noon temperature on that day. Here are
their figures for the last 12 days:
Ice Cream Sales vs Temperature
Temperature °C Ice Cream Sales
14.2° $215
16.4° $325
11.9° $185
15.2° $332
18.5° $406
22.1° $522
19.4° $412
25.1° $614
23.4° $544
18.1° $421
22.6° $445
17.2° $408
How to construct Scatterplots
Interpreting scatterplots
Direct Positive
Linear Relationship
No Relationship
Outliers
Assessing Correlation Numerically –
Correlation Coefficient
Alternative formula
Assessing Correlation Numerically –
Correlation Coefficient
Lets talk direction and strength
Assessing Correlation Numerically –
Correlation Coefficient
Example
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟
17 150
15 154
19 169
17 172
21 175
89 820
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150
15 154
19 169
17 172
21 175
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150 N=?
15 154
19 169
17 172
21 175
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150 N=5
15 154
19 169
17 172
21 175
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150 N=5
∑ 𝑥=?
15 154
19 169
17 172
∑ 𝑦=?
21 175
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150
N=5
∑ 𝑥=89
15 154
19 169
17 172
∑ 𝑦=820
21 175
89 820
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17
15
19
150
154
169
∑ 𝑥=89
N=5
∑ 𝑦=82
∑ (𝑥×𝑦)=?
17 172
21 175
89 820
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17
15
150
154
2,550
2,310
∑ 𝑥=89
N=5
∑ 𝑦=82
19
17
21
169
172
175
3,211
2,924
3,675
∑ (𝑥×𝑦)=14,670
89 820 14,670
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17
15
150
154
2,550
2,310
∑ 𝑥=89
N=5
∑ 𝑦=82
19
17
169
172
3,211
2,924 ∑ (𝑥×𝑦)=14,670
21 175 3,675
∑ 𝑥 =? ∑ 𝑦 =?
89 820 14,670
2 2
Assessing Correlation Numerically –
Correlation Coefficient
Solution
Use the information in the table below to calculate the
correlation coefficient.
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150 2,550 289 22,500 ∑ 𝑥=89
N=5
∑ 𝑦=82
∑ (𝑥×𝑦)=14,670
15 154 2,310 225 23,716
19 169 3,211 361 28,561
17 172 2,924 289 29,584
21 175 3,675 441 30,625 1,605
89 820 14,670 1,605 134,986
134,986
Assessing Correlation Numerically –
Correlation Coefficient
Solution
࢞ ࢟ ࢞ൈ
࢟ ࢞ ࢟
17 150 2,550 289 22,500
15 154 2,310 225 23,716
19 169 3,211 361 28,561
17 172 2,924 289 29,584
21 175 3,675 441 30,625
89 820 14,670 1,605 134,986
Assessing Correlation Numerically –
Correlation Coefficient
Solution using alternative formula
࢞ ࢟ ࢞ െ࢞
ഥ ࢟ െ࢟
ഥ ሺ࢞ െ
࢞ഥሻሺ࢟ െ࢟
ഥሻ ሺ࢞ െഥሻ ሺ࢟ െ
࢞ ഥሻ
࢟
Income
Size of household
Preferences and taste
Independent variable =?
Dependent Variable =?
Simple Linear Regression: Equation
Population : Y 0 1X
Where
Y = dependent variable (response)
X = independent variable (predictor or explanatory)
0 = intercept (value of Y when X = 0)
1 = slope of the regression line
e = random error (unexplained variation)
= the estimated or predicted value of y based on regression
model
Simple Linear Regression: Estimating
Alpha & Beta
^
𝒚 =𝜶 +𝒃 𝒙 Slope coefficient:
y - intercept:
Or
Or
Simple Linear Regression: Estimating
Example:
A sample of households was taken from a small city and information
on their incomes and food expenditures is displayed in the table
below (in hundreds of dollars: find the values of and for the
regression model
Income Food Expenditure
55 14
83 24
38 13
61 16
33 9
49 15
67 17
Simple Linear Regression: Estimating
Solution:
What is the x variable & Y variable?
What is n?
Income Food Expenditure
^𝒚 =𝜶+𝒃 𝒙 55 14
83 24
38 13
𝛼=𝑦 − 𝑏 𝑥 61 16
33 9
𝒏 ( ∑ 𝑥𝑦 ) − ( ∑ 𝑥 )( ∑ 𝑦 ) 49 15
𝑏= 2 67 17
𝒏 ∑ 𝑥 2 − (∑ 𝑥 )
Simple Linear Regression: Estimating
𝛼=𝑦 − 𝑏 𝑥
Solution:
𝒏 ( ∑ 𝑥𝑦 ) − ( ∑ 𝑥 ) ( ∑ 𝑦 )
𝑏= 2
𝒏 ∑ 𝑥 − (∑ 𝑥 )
2
Food
Income Expenditure
࢞ ࢞ൈ
࢟ ࢞ ࢟
࢟
1 55 14
2 83 24
3 38 13
4 61 16
5 33 9
6 49 15
7 67 17
Simple Linear Regression: Estimating
𝛼=𝑦 − 𝑏 𝑥
Solution:
𝒏 ( ∑ 𝑥𝑦 ) − ( ∑ 𝑥 ) ( ∑ 𝑦 )
𝑏= 2
𝒏 ∑ 𝑥 − (∑ 𝑥 )
2
Food
Income Expenditure ࢞ൈ
࢟ ࢞ ࢟
࢞ ࢟
55 14 770 3,025 196
83 24
38 13
61 16
33 9
49 15
67 17
386 108
Simple Linear Regression: Estimating
𝛼=𝑦 − 𝑏 𝑥
Solution:
𝒏 ( ∑ 𝑥𝑦 ) − ( ∑ 𝑥 ) ( ∑ 𝑦 )
𝑏= 2
𝒏 ∑ 𝑥 − (∑ 𝑥 )
2
Food
Income Expenditure
࢞ ࢞ൈ
࢟ ࢞ ࢟
࢟
55 14 770 3,025 196
83 24 1,992 6,889 576
38 13 494 1,444 169
61 16 976 3,721 256
33 9 297 1,089 81
49 15 735 2,401 225
67 17 1,139 4,489 289
386 108 6,403 23,058 1,792
Simple Linear Regression: Estimating
𝛼=𝑦 − 𝑏 𝑥
Solution:
𝒏 ( ∑ 𝑥𝑦 ) − ( ∑ 𝑥 ) ( ∑ 𝑦 )
𝑏= 2
𝒏 ∑ 𝑥 − (∑ 𝑥 )
2
Food
Income Expenditure 7 ( 6,403 ) −(386 ×108)
࢞
࢞ൈ
࢟ ࢞ ࢟ 𝑏= =¿
࢟ 7 ( 23,058 ) −386
2
࢞ ࢟ ࢞ െ࢞
ഥ ࢟ െ࢟
ഥ ሺ࢞ െ
࢞ഥሻሺ࢟ െ࢟
ഥሻ ሺ࢞ െഥሻ ሺ࢟ െ
࢞ ഥሻ
࢟
447.6
𝑏= =0.2525
1,772.9
Simple Linear Regression: Estimating
Solution: 𝑏=0.2525
𝜶=𝒚 −𝒃 𝒙
Food
Income Expenditure
࢞ ࢞ൈ
࢟ ࢞ ࢟
࢟
55 14 770 3,025 196
83 24 1,992 6,889 576 What is the mean of the
38 13 494 1,444 169 X and Y variables?
61 16 976 3,721 256
33 9 297 1,089 81
49 15 735 2,401 225
67 17 1,139 4,489 289
386 108 6,403 23,058 1,792
Simple Linear Regression: Estimating
Solution: 𝑏=0.2525
𝜶=𝒚 −𝒃 𝒙
Food
Income Expenditure
࢞ ࢞ൈ
࢟ ࢞ ࢟
࢟
55 14 770 3,025 196 𝒚=𝟏𝟓.𝟒𝟐𝟖𝟔
83 24 1,992 6,889 576
38 13 494 1,444 169 𝒙=𝟓𝟓. 𝟏𝟒𝟐𝟗
61 16 976 3,721 256
33 9 297 1,089 81
49 15 735 2,401 225
67 17 1,139 4,489 289
386 108 6,403 23,058 1,792
Simple Linear Regression: Estimating
Solution: 𝑏=0.2525
𝛼=𝑦 − 𝑏 𝑥
Food
Income Expenditure ࢞ൈ
࢟ ࢞ ࢟ 𝒚=𝟏𝟓.𝟒𝟐𝟖𝟔
࢞ ࢟
55 14 770 3,025 196 𝒙=𝟓𝟓. 𝟏𝟒𝟐𝟗
83 24 1,992 6,889 576
38 13 494 1,444 169 15.4286 - 0.2525(55.1429)
61 16 976 3,721 256
33 9 297 1,089 81 𝛼=15.4286 −13.9212
49 15 735 2,401 225
67 17 1,139 4,489 289 𝛼=1.5073
386 108 6,403 23,058 1,792
Simple Linear Regression: Estimating
Solution: ^
𝒚 = 𝜶 +𝒃 𝒙
Food
Income Expenditure
𝛼=1.5073
࢞ ࢞ൈ
࢟ ࢞ ࢟
࢟
55 14 770 3,025 196 𝑏=0.2525
83 24 1,992 6,889 576
38 13 494 1,444 169
61 16 976 3,721 256
33 9 297 1,089 81 ^
𝑦 =1.5073+0.2525 𝑥
49 15 735 2,401 225
67 17 1,139 4,489 289
386 108 6,403 23,058 1,792
Income
Simple Linear Regression: Prediction
^
𝐹𝑜𝑜𝑑 𝐸𝑥𝑝𝑒𝑛𝑑𝑖𝑡𝑢𝑟𝑒=1.5073+ 0.2525 ( 61 )
¿𝟏𝟔.𝟗𝟎𝟕𝟑 𝒉𝒖𝒏𝒅𝒓𝒆𝒅=$𝟏,𝟔𝟗𝟎.𝟕𝟐𝟓𝟐
On average, all households with a monthly income of $6100 spend approximately
$1,690.7252 per month on food.
Simple Linear Regression: Prediction
Income
^
𝐹𝑜𝑜𝑑 𝐸𝑥𝑝𝑒𝑛𝑑𝑖𝑡𝑢𝑟𝑒=1.5073+ 0.2525 ( 32 )=𝟗 . 𝟓𝟖𝟔𝟎=$ 𝟗𝟓𝟖 .𝟓𝟗𝟕𝟗
^
𝐹𝑜𝑜𝑑 𝐸𝑥𝑝𝑒𝑛𝑑𝑖𝑡𝑢𝑟𝑒=1.5073+ 0.2525 ( 98 ) =𝟐𝟔 . 𝟐𝟒𝟖𝟖=$ 𝟐 , 𝟔𝟐𝟒 . 𝟖𝟏𝟖𝟕
Coefficient of Determination ()