Docsity

Elementary Stats: Regression & Relationships between Two Variables - Prof. Nancy M. Pfenni, Study notes of Data Analysis & Statistical Methods

Toggle sidebar
bg1
(C) 2007 Nancy Pfenning
Elementary Statistics: Looking at the Big Picture 1
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture
Lecture 12
Relationships between Two
Quantitative Variables; Regression
Equation of Regression Line; Residuals
Effect of Explanatory/R esponse Roles
Unusual Observations
Sample vs. Population
Time Series; Additiona l Variables
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11.2
Looking Back: Review
4 Stages of Statistics
Data Production (discussed in Lectures 1-4)
Displaying and Summarizing
Single variables: 1 cat,1 q uan (discussed Lectures 5-8)
Relationships between 2 variables:
Categorical and quantitative (d iscussed in Lecture 9)
Two categorical (discussed in Lecture 10)
Two quantitative
Probability
Statistical Inference
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11.3
Review
Relationship between 2 quantitative variables
Display with scatterplot
Summarize:
Form: linear or curved
Direction: positive or negative
Strength: strong, modera te, weak
If form is linear, co rrelation r tells dir ection and strength.
Also, equation of least sq uares regression line lets us
predict a response for any explanatory value x.
(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11.4
Least Squares Regression Line
Summarize linear relationship between
explanatory (x) and response (y) values with
line that minimizes sum of
squared prediction errors (called residuals).
Slope: predicted change in response y for
every unit increase in explanatory value x
Intercept: where best-fitting line crosses y-
axis (predicted response for x=0?)
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Elementary Stats: Regression & Relationships between Two Variables - Prof. Nancy M. Pfenni and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity!

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture

Lecture 12

Relationships between Two

Quantitative Variables; Regression

Equation of Regression Line; Residuals Effect of Explanatory/Response Roles Unusual Observations Sample vs. Population Time Series; Additional Variables (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 2

Looking Back: Review

 4 Stages of Statistics

 Data Production (discussed in Lectures 1-4)  Displaying and Summarizing  Single variables: 1 cat,1 quan (discussed Lectures 5-8)  Relationships between 2 variables:  Categorical and quantitative (discussed in Lecture 9)  Two categorical (discussed in Lecture 10)  Two quantitative  Probability  Statistical Inference (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 3

Review

 Relationship between 2 quantitative variables

 Display with scatterplot  Summarize:  Form: linear or curved  Direction: positive or negative  Strength: strong, moderate, weak If form is linear, correlation r tells direction and strength. Also, equation of least squares regression line lets us predict a response for any explanatory value x. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 4

Least Squares Regression Line

Summarize linear relationship between

explanatory ( x ) and response ( y ) values with

line that minimizes sum of

squared prediction errors (called residuals ).

 Slope: predicted change in response y for

every unit increase in explanatory value x

 Intercept: where best-fitting line crosses y -

axis (predicted response for x =0?)

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 5

Example: Least Squares Regression Line

Background : Car-buyer used software to regress price on age for 14 used Grand Am’s.  Question: What do the slope (-1288) and intercept (14,690) tell us? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 7

Example: Least Squares Regression Line

Background : Car-buyer used software to regress price on age for 14 used Grand Am’s.  Response:Slope: For each additional year in age, predict price…  Intercept: Best-fitting line… (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 8

Example: Extrapolation

Background : Car-buyer used software to regress price on age for 14 used Grand Am’s.  Question: Should we predict a new Grand Am to cost $14,690-$1288(0)=$14,690? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 10

Example: Extrapolation

Background : Car-buyer used software to regress price on age for 14 used Grand Am’s.  Response:

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 16 Expressions for slope and intercept

Consider slope and intercept of the least squares

regression line

 Slope: so if x increases by a

standard deviation, predict y to increase by r

standard deviations

 Intercept: so when

predict

the line passes through the point of averages

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 17

Example: Individual Summaries on Scatterplot

Background : Car-buyer plotted price vs. age for 14 used Grand Ams [(4, 13000), (8, 4000), etc.]  Question: What are the approximate means and sds of age and price? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 21

Example: Individual Summaries on Scatterplot

Background : Car-buyer plotted price vs. age for 14 used Grand Ams [(4, 13000), (8, 4000), etc.]  Response: Age has approx. mean __ yrs, sd __ yrs; price has approx. mean $_______, sd $_______. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 22 Definitions

 Residual: error in using regression line

to predict y given x. It equals

the vertical distance observed minus predicted

which can be written

 s : denotes typical residual size, calculated as

Note: s just “averages” out the residuals

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 23

Example: Considering Residuals

Background : Car-buyer regressed price on age for 14 used Grand Ams [(4, 13000), (8, 4000), etc.]  Question: What does s = 2175 tell us? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 25

Example: Considering Residuals

Background : Car-buyer regressed price on age for 14 used Grand Ams [(4, 13000), (8, 4000), etc.].  Response: Regression line predictions not perfect:  x =4predict y = actual y =13,000prediction error=  x =8predict y = actual y = 4000 prediction error=  Typical size of 14 prediction errors is _________ (dollars) (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 26

Example: Considering Residuals

 Typical size of 14 prediction errors is s = 2,175 (dollars): Some points’ vertical distance from line more, some less; 2,175 is typical distance. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 27

Example: Residuals and their Typical Size s

Background: For a sample of schools, regressed  average Math SAT on average Verbal SAT  average Math SAT on % of teachers w. advanced degrees  Question: How are s =7.08 (left) and s =26.2 (right) consistent with the values of the correlation r?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 37

Example: Typical Residual Size s close to

Background : 2008-9 Football Season Scores Regression Analysis: Steelers versus Opponents The regression equation is Steelers = 23.5 - 0.053 Opponents S = 9. Descriptive Statistics: Steelers Variable N Mean Median TrMean StDev SE Mean Steelers 19 22.74 23.00 22.82 9.66 2. Variable Minimum Maximum Q1 Q Steelers 6.00 38.00 14.00 31. Question: Since s =9.931 and =9.66 are very close, do you expect | r | close to 0 or 1? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 39

Example: Typical Residual Size s close to

Background : 2008-9 Football Season Scores Regression Analysis: Steelers versus Opponents The regression equation is Steelers = 23.5 - 0.053 Opponents S = 9. Descriptive Statistics: Steelers Variable N Mean Median TrMean StDev SE Mean Steelers 19 22.74 23.00 22.82 9.66 2. Variable Minimum Maximum Q1 Q Steelers 6.00 38.00 14.00 31. Response: r must be close to ___ (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 40 Explanatory/Response Roles in Regression

Our choice of roles, explanatory or response,

does not affect the value of the correlation r ,

but it does affect the regression line.

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L6. 41

Example: Regression Line when Roles are

Switched

Background : Compare regression of y on x (left) and regression of x on y (right) for same 4 points:  Question: Do we get the same line regressing y on x as we do regressing x on y?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L6. 43

Example: Regression Line when Roles are

Switched

Background : Compare regression of y on x (left) and regression of x on y (right) for same 4 points:  Response: The lines are very different.  Regressing y on x : _____________slope  Regressing x on y : _____________slope (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 44 Definitions

 Outlier: (in regression) point with unusually

large residual

 Influential observation: point with high

degree of influence on regression line.

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 45

Example: Outliers and Influential Observations

Background : Exploring relationship between orders for new planes and fleet size of some airlines in

  1. ( r =+0.69)  Question: Is each of these an outlier or influential?  SouthwestJetBlue (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 47

Example: Outliers and Influential Observations

Background : Exploring relationship between orders for new planes and fleet size. ( r =+0.69)  Response:Southwest: ___________ (omit it r reduces to +0.22)  JetBlue: _______ (large residual) and ____________ (omit it r increases to +0.97)

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 53

Example: Role of Sample Size

Background : Relationship between ages of students’ mothers and fathers both have r =+0.78, but sample size is over 400 (on left) or just 5 (on right):  Question: Which plot provides more evidence of strong positive relationship in population? (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 55

Example: Role of Sample Size

Background : Relationship between ages of students’ mothers and fathers both have r =+0.78, but sample size is over 400 (on left) or just 5 (on right):  Response: Plot on ______. Can believe configuration on _____occurred by chance. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 56 Time Series

If explanatory variable is time, plot one response

for each time value and “connect the dots” to

look for general trend over time, also peaks

and troughs.

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 57

Example: Time Series

Background : Time series plot shows average daily births each month in year 2000 in the U.S.:  Question: Where do you see a peak or a trough?

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 59

Example: Time Series

Background : Time series plot shows average daily births each month in year 2000 in the U.S.:  Response: Trough in ______, peak in ________ (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 60

Example: Time Series

Background : Time series plot shows average daily births each month in year 2000 in the U.S.:  Questions: How can we explain why there are…  Conceptions in U.S.: fewer in July, more in December?  Conceptions in Europe: more in summer, fewer in winter? Trough in April, 9 months after July Peak in September, 9 months after December (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 61

Example: Time Series

Background : Time series plot shows average daily births each month in year 2000 in the U.S.:  Response: Difficult to explain… A Closer Look: Statistical methods can’t always explain “why”, but at least they help understand “what” is going on. (C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 62 Additional Variables in Regression

 Confounding Variable: Combining two

groups that differ with respect to a variable

that is related to both explanatory and

response variables can affect the nature of

their relationship.

 Multiple Regression: More advanced

treatments consider impact of not just one but

two or more quantitative explanatory

variables on a quantitative response.

(C) 2007 Nancy Pfenning Elementary Statistics: Looking at the Big Picture L11. 69 Lecture Summary (Regression)  Equation of regression line  Interpreting slope and intercept  Extrapolation  Residuals: typical size is s  Line affected by explanatory/response roles  Outliers and influential observations  Line for sample or population; role of sample size  Time series  Additional variables