Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linear Regression Day 1 – (pg )

Similar presentations


Presentation on theme: "Linear Regression Day 1 – (pg )"— Presentation transcript:

1 Linear Regression Day 1 – (pg 176-184)
Chapter 7 Linear Regression Day 1 – (pg )

2 Correlation and Regression
Correlation = linear relationship between two variables. Summarize relationship with line. Called Regression line. Explanatory variable (x) Response variable (y)

3 Regression line Explains how response variable (y) changes in relation to explanatory variable (x). Use line to predict value of y for given value of x. The predicted values are called Values on the regression line. The observed values are called y. Points in the scatterplot. Look at 2 examples

4 Regression line Residual - the difference between the observed value and its associated predicted value. To find the residuals, we always subtract the predicted value from the observed one:

5 Least squares regression (LSRL)
Most commonly used regression line. Puts line where sum of the squared errors (residuals) as small as possible. Minimizes Based on statistics

6 Regression line equation
where

7 Regression line equation
b1 = slope of line. For every unit increase in x, changes by the amount of the slope. Very important for interpreting data. b0 = y-intercept of line. The value of when x = 0. Usually not important for interpreting data. Values of x are usually not close to 0.

8

9 Calculating the regression line.
Degree Days vs. Gas Usage

10 Calculating the regression line.
Degree Days vs. Gas Usage

11 Calculating the regression line.
Degree Days vs. Gas Usage

12 Calculating the regression line.
Degree Days vs. Gas Usage

13 Calculating the regression line.
Don’t forget to write the equation. Where = predicted gas usage x = degree days ALWAYS IDENTIFY THE VARIABLES

14 Interpretations Slope Intercept
For every one unit increase in degree days, the predicted gas usage increases by 0.19 Intercept When the degree days is 0, the predicted gas usage is 1.07

15 Prediction Use regression equation to predict y from x.
Ex. Predicted gas consumption when degree days = 40? Ex. Predicted gas consumption when degree days = 20?

16 Prediction Use regression equation to predict y from x.
Ex. Predicted gas consumption when degree days = 40? Ex. Predicted gas consumption when degree days = 20?

17 Prediction Use regression equation to predict y from x.
Ex. Predicted gas consumption when degree days = 40? Ex. Predicted gas consumption when degree days = 20?

18 Plotting the regression line
Find two points on line. Pick two x values Find predicted for each x value. Ex. x = 20, =4.87 and x = 40, = 8.67 Plot two points on graph. Make line through two points. Regression line .

19

20 Finding In Calculator Stat  Edit  Enter Data in L1 and L2
Stat  Calc  8: LinReg (y = a + bx) x y LSRL:

21 Example: A random sample of records of sales of homes from Feb. 15 to Apr. 30, 1993, from the files maintained by the Albuquerque Board of Realtors gives the price (in thousands of dollars) and size (in square feet) of 117 homes. A regression analysis gives us the model: What does the slope of this line say about housing prices and house size? What price would you predict to pay for a 3000 square foot home? A real estate agent shows a potential buyer a 1200 sq-ft home with an asking price that is $6000 less than one would expect to pay for a house of that size. What is the asking price?

22 Example Every square foot increase in size increases the average price $0.061x1000, or $61. $230,820 ( thousand) $115,020

23 Homework – Read Chapter 7 Pg 184 – 196
Ch 7 Day 1 WS

24 Properties of regression line
Regression line always goes through point r is connected to the value of b1. r has same sign as b1. (If slope is negative, correlation is negative & vice versa)

25 Properties of regression line
The values of the y variable vary. Regression line tries to explain variation of y through its relationship with x. Not perfectly – points not exactly on line. Points close to line = regression explains variation of y well. Points far from line = regression does not explain variation of y well.

26 Properties of regression line
How much variation can we explain with our regression? Answer: R2 Percent of variation in y that is explained by the linear relationship with x. Higher values of R2 mean regression line helps explain the variation in y variable.

27 Degree Days vs. Gas Usage
R2 = r2 Ex. r = , R2 = or 99.06% of the variation in gas usage can be explained by the linear relationship with number of degree days.

28 Example: Roller Coasters
People who responded to a July 2004 Discovery Channel poll names the 10 best roller coasters in the United States. A table in Chapter 7, Exercise 33 shows the length of the initial drop (in feet) and the duration of the ride (in seconds). A regression to predict duration from drop has R2=12.4%. What are the variables and units in this regression? Write a sentence (in context) summarizing that the R2 says about this regression. What is the correlation between drop and duration?

29 Example: Roller Coasters
a. y: Duration (in seconds) x: drop (in feet) b. Differences in height explain 12.4% of the variability in the duration of the ride… (or better)… “12.4% of the variation in y (the duration of the ride) can be explained by the least squares regression with x (length of the initial drop).” c

30 Residuals Variation in y not measured by regression line. Formula:
Residual for each data point. Mean of residuals = 0.

31 Example: Calculating Residuals
Degree Days vs. Gas Usage Find the residual for the point (30,6.4)

32 Calculating Residuals
Degree Days vs. Gas Usage Find the residual for the point (30,6.4)

33 Calculating Residuals
Degree Days vs. Gas Usage Find the residual for the point (30,6.4)

34 Calculating Residuals
Find the residual for the point (13,4.0)

35 Calculating Residuals
Find the residual for the point (13,4.0)

36 Calculating Residuals
Find the residual for the point (13,4.0)

37 Residual Plots Scatterplot Good Residual Plot
Explanatory variable (x) on horizontal axis. Residuals (e) on vertical axis. Horizontal line at residual = 0. Good Residual Plot No pattern or shape No outliers

38 Interpreting Residual Plots
The residual plot should show about the same amount of scatter throughout!! If it has a… Curved Pattern relationship is not linear. Increasing spread about line as x increases. Predictions of y for larger x will be less accurate. Decreasing spread about line as x increases. Predictions of y for smaller x will be less accurate.

39

40 Example: Children’s Ages and Heights
The ages (in months) and heights (in inches) of seven children are given. x y Find the LSRL. Interpret the slope and correlation coefficient in the context of the problem.

41 Correlation coefficient:
There is a strong, positive, linear association between the age and height of children. Slope: For an increase in age of one month, there is an approximate increase of .34 inches in heights of children.

42 Predict the height of a child who is 4.5 years old.
The ages (in months) and heights (in inches) of seven children are given. x y Predict the height of a child who is 4.5 years old. Predict the height of someone who is 20 years old. Graph, find lsrl, also examine mean of x & y

43 Create the residual plot of the data in your calculator:
Stat  Edit  Enter Data in L1 and L2 Stat  Calc  8: LinReg (y = a + bx) 2nd  y= (stat plot)  Plot 1 Type: Scatterplot Xlist = L1 Ylist = 2nd  Stat (List)  7: Residuals Enter Zoom  9 Is a LSRL appropriate here? Why?

44 Extrapolation The LSRL should not be used to predict y for values of x outside the data set. It is unknown whether the pattern observed in the scatterplot continues outside this range.

45

46 Reading Computer Output
Exercise physiologists are investigating the relationship between lean body mass (in kilograms) and the resting metabolic rate (in calories per day) in sedentary males. What is the LSRL?

47 The correlation coefficient and the LSRL are both non-resistant measures.

48 You should be able to…. Calculate a regression line given summary statistics. Interpret the slope and intercept of the regression line. Find predictions and residuals for points. Interpret a residual plot. Interpret the R2 value for a regression. Understand the limitations of regression.


Download ppt "Linear Regression Day 1 – (pg )"

Similar presentations


Ads by Google