Docsity

Predicting Variables with Scatterplots & Regression Lines - Prof. Algarabel González, Apuntes de Estadística

Vista previa parcial del texto

¡Descarga Predicting Variables with Scatterplots & Regression Lines - Prof. Algarabel González y más Apuntes en PDF de Estadística solo en Docsity!

Chapter 8

Linear Regression

Today’s Questions

  • How can we predict one variable from

another?

  • Can we predict academic performance

from an intelligence test?

  • Can we predict academic performance

using a motivational scale?

Slide 4 - 2

The Linear Model

  • The correlation in this example is 0.83. It

says “There seems to be a linear

association between these two variables,”.

The Linear Model (cont.)

  • The linear model is just an equation of a

straight line through the data.

  • The points in the scatterplot don’t all line up,

but a straight line can summarize the general

pattern with only a couple of parameters.

Residuals (cont.)

  • The difference between the observed

value and its associated predicted value is

called the residual.

  • To find the residuals, we always subtract

the predicted value from the observed

one:

residual = observed − predicted = y −

y

Residuals (cont.)

  • A negative residual

means the predicted

value’s too big (an

overestimate).

  • A positive residual means

the predicted value’s too

small (an underestimate).

  • In the figure, the

estimated fat of the BK

Broiler chicken sandwich

is 36 g, while the true

value of fat is 25 g, so the

residual is –11 g of fat.

Correlation and the Line

  • The figure shows the

scatterplot of z -scores for

fat and protein.

  • If a burger has average

protein content, it should

have about average fat

content too.

  • Moving one standard

deviation away from the

mean in x moves us r

standard deviations away

from the mean in y.

The Regression Line in Real Units

  • Remember from Algebra that a straight line can be

written as:

  • In Statistics we use a slightly different notation:
  • We write to emphasize that the points that satisfy this

equation are just our predicted values, not the actual

data values.

  • This model says that our predictions from our model

follow a straight line.

  • If the model is a good one, the data values will scatter

closely around it.

y = mx + b

y = b

0

  • b

1

x

y

The Regression Line in Real

Units (cont.)

  • In our model, we have a slope ( b

1

  • The slope is built from the correlation and the

standard deviations:

b

1

= r

s

y

s

x

The Regression Line in Real

Units (cont.)

  • In our model, we also have an intercept

( b

0

  • The intercept is built from the means and the

slope:

b

0

= y − b

1

x

The Regression Line in Real

Units (cont.)

  • Since regression and correlation are

closely related, we need to check the

same conditions for regressions as we did

for correlations:

  • Quantitative Variables Condition
  • Straight Enough Condition
  • Outlier Condition

Residuals Revisited

  • The linear model assumes that the

relationship between the two variables is a

perfect straight line. The residuals are the

part of the data that hasn’t been modeled.

Data = Model + Residual

or (equivalently)

Residual = Data – Model

Or, in symbols,

e = y −

y

Residuals Revisited (cont.)

  • The residuals for the BK menu regression

look appropriately boring:

The Residual Standard Deviation

  • The standard deviation of the residuals, s

e

,

measures how much the points spread around

the regression line.

  • Check to make sure the residual plot has about

the same amount of scatter throughout. Check

the Equal Variance Assumption with the Does the

Plot Thicken? Condition.

  • We estimate the SD of the residuals using:

s

e

e

2

n − 2