Docsity

Simple Linear Regression: Estimating Cereal Ratings Based on Sugar Content, Slides of Data Warehousing

Toggle sidebar
bg1
2
An Example of Simple Linear
Regression
•
Cereals
data set contains nutritional information for 77
cereals
•Includes
sugars
and
rating
variables
•Suppose we estimate
rating
of a cereal, given its sugar
content?
•Use
sugars
(predictor) to estimate
rating
(response)
Cereal Name Manuf Sugars Calories Protein Fat Sodium Rating
100% Bran N 6 70 4 1 130 68.4030
100% Natural Bran Q 8 120 3 5 15 33.9837
All-Bran K 5 70 4 1 260 59.4255
All-Bran Extra Fiber K 0 50 4 0 140 93.7049
Almond Delight R 8 110 2 2 200 34.3848
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Simple Linear Regression: Estimating Cereal Ratings Based on Sugar Content and more Slides Data Warehousing in PDF only on Docsity!

An Example of Simple LinearRegression•Cereals data set contains nutritional information for 77cereals•^ Includessugars and^2

rating variables

•^ Suppose we estimate

rating of a cereal, given its sugar

content?• Usesugars (predictor) to estimate

rating (response)

Cereal Name^ Manuf^ Sugars^ Calories

Protein^ Fat^ Sodium^ Rating 100% Bran^ N^6

100% Natural Bran^ Q^8

All-Bran^ K^5

All-Bran Extra Fiber^ K^0

Almond Delight^ R^8

An Example of Simple LinearRegression(cont’d)•^ Scatter plot ofrating vs.^3

sugars and least squares

regression line^ ActualRating (for^ Cheerios • Regression Line or Estimated Regression Equation(ERE):

EstimatedRating ) ˆ^^ xbby^ ^10

An Example of Simple LinearRegression(cont’d)•^ Suppose ERE used to estimate rating for new cerealcontaining 1 gram of sugar?•^ Estimated value lies directly on ERE at (x = 1,^5

ŷ^ =

56.98)• Data set contains cereal with 1 gram of sugar (Cheerios)• However, Cheerios rating = 50.765 at (x = 1, y =50.765)

ˆ^  y

An Example of Simple LinearRegression(cont’d)•^ ERE prediction too high by 56.98 – 50.765 = 6.215rating points?•^ Vertical difference (y -^6

ŷ) = 56.98 – 50.765 known as

prediction error orresidual• We seek ERE that minimizes size of residuals• Least Squares Regression calculates unique ERE• Minimizes sum of squared residuals over all data points

The Least Squares Estimates^8

(cont’d)

•^ Suppose two or more cereals have same rating butdifferent sugar content?•^ Error term^ ε^ accounts for indeterminacy in model•^ Residuals (y-^ ŷ) are estimates of error termsi^

ε, i =i^

1,...,n • RecallCereals data set with ERE• Next, values for band b^0

are derived using the Method 1

of Least Squares

ˆ^ )(^42.^24.^59 Sugarsy^  docsity.com

The Least Squares Estimates^9

(cont’d)

•^ Suppose we haven observations from model•^ Least squares line minimizes population sum of squares•^ Population sum of squared errors re-expressed•^ Differential calculus determines values for

βand^ β^0

which minimize

nix

y^ iii^

 n^2 ^ SSE^^ ^ ip  i^^1

)( i

nn iip ii^

xy

SSE^ ^ ^ ^

 n 2  i  i 1 docsity.com

The Least Squares Estimates^11

(cont’d)

•^ Next, summation distributed then equations re-expressed•^ Finally, solving for b

and byields 0 1

•^ x-bar is mean value for predictor, y-bar is mean valuefor response, n = total number of observations•^ Formulas summed i = 1,...,n

nn  yxbnb  ii 10  i^ i^11^ nnn 2  yxxbxb^   iiii 10   i^ ii^11 1 ^ ^ ^  nyxyx /  iiii  bxby 122 ^  nxx^ /^  ii

b^ ^10

The Least Squares Estimates^12

(cont’d)

•^ Formulas produce b

and b, least squares estimates for 0 1 βand β, respectively 0 1

•^ Applying formulas to 77 observations in

Cereals data set

produces estimates b^0

= 59.4 and b= -2.42 1

^ • Values are y-intercept and slope for ERE

^     791429. 359642.^2675325. 1486

/^77 /)^26.^3285 )(^534 (^7.^186 ,^192277 /)^534 (^5190 /

 nyxyx   iiii  b 12 ^ nxx   ii ^ 

^ xbyb

The Least Squares Estimates^14

(cont’d)

•^ Slope of ERE measures change in y per unit increase x•^ b= -2.42 interpreted as: “For each increase in one^1 gram in sugar content, the estimated nutritional ratingdecreases by 2.42 rating points”

The Coefficient of Determination r^15

•^ Least Squares Regression Method can approximatelinear relationship between any two variables•^ How useful is regression line?•^ Useful for making predictions?^2 •^ rstatistic is Coefficient of Determination and measuresERE’s goodness of fit to data•^ Consider Orienteering data set size = 10•^ Measures elapsed time and distance traveled by hikers

The Coefficient of Determination r^17

(cont’d)•^ Sum of Squares Error SSE =

2 ∑(y - ŷ)= 12

•^ Represents overall measure of error in ERE’s prediction•^ Now, is SSE = 12 large or small?•^ What can we compare it to?•^ Assume we estimate

distance traveled withoutknowledge oftime

•^ That is, we lack access to predictor information•^ Less information available usually results in less accurateestimates

The Coefficient of Determination r^18

(cont’d)•^ Now, y-bar = 16 best estimate for all competitors,regardless of time hiking•^ Clearly not an optimal prediction