Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 4 - 4 Nonlinear Regression: Transformations.

Similar presentations


Presentation on theme: "Lesson 4 - 4 Nonlinear Regression: Transformations."— Presentation transcript:

1 Lesson 4 - 4 Nonlinear Regression: Transformations

2 Objectives Change exponential expressions to logarithmic expressions and logarithmic expressions to exponential expressions Simplify expressions containing logarithms Use logarithmic transformations to linearize exponential relations Use logarithmic transformations to linearize power relations

3 Vocabulary Response Variable – variable whose value can be explained by the value of the explanatory or predictor variable Predictor Variable – independent variable; explains the response variable variability Lurking Variable – variable that may affect the response variable, but is excluded from the analysis Positively Associated – if predictor variable goes up, then the response variable goes up (or vice versa) Negatively Associated – if predictor variable goes up, then the response variable goes down (or vice versa)

4 Non-linear Scatter Diagrams Exponential Power Some relationships that are nonlinear can be modeled with exponential or power models  y = a b x (with b > 1)  y = a b x (with b < 1)  y = a x b

5 Exponential Data ●We would like to fit an exponential model y = a b x ●We would still like to use our least-squares linear regression techniques on this model ●If we take the logarithms of both sides, we get log y = log a + x log b because log(a b x ) = log(a) + log(b x ) = log a + x log b

6 Exponential to Linear Transform ●We modify this transformed equation log y = log a + x log b ●Define these new variables  Y = log y  A = log a  B = log b  X = x ●Then this equation becomes Y = A + B X

7 Least Squares on Exponential Model ●We started with an exponential model y = a b x ●We transformed that into a linear model Y = A + B X ●After we solve the linear model, we match up  b = 10 B  a = 10 A ●In this way, we are able to use the method of least-squares to find an exponential model

8 Harley Davidson Dataset Year (x) Closing Price (y) 1990 1.1609 1991 2.6988 1992 4.5381 1993 5.3379 1994 6.8032 1995 7.0328 1996 11.5585 Year (x) Closing Price (y) 1997 13.4799 1998 23.5424 1999 31.9342 2000 39.7277 2001 54.31 2002 46.20 2003 47.53 2004 60.75

9 Exponential Example The scatter diagram below appears to be exponential (curved) and not linear A line is not an appropriate model

10 Fitting an Exponential Model We use Y = log y and X = x  The first observation is x = 1 and y = 1.1609, thus the first observation of the transformed data is X = 1 and Y = log 1.1609 = 0.0648  The second observation is x = 2 and y = 2.6988, thus the second observation of the transformed data is X = 2 and Y = log 2.6988 = 0.4312  We continue and take logs of all of the y values

11 Using your Calculator To get the scatter plot we inputted x-values into L1 and the y-values into L2 To change the y-values into logs we go to the top of L3 and hit LOG(L2) ENTER and then use LINREG to find a and b (first part of the slide after next) Or a simpler way yet, use the ExpReg calculation under STAT and CALC and get it directly without having to convert back (last line of the slide after next)

12 Transformed Line The scatter diagram of the transformed data (Y and X) is more linear We now calculate least-squares regression line for this data

13 Least Squares to Exponential ●The least squares line is Y = 0.1161 X + 0.2107  B = 0.1161  A = 0.2107 ●This is transformed back to  b = 10 B = 10 0.1161 = 1.3064 and  a = 10 A = 10 0.2107 = 1.6244, so y = 1.6244 (1.3064) x

14 Exponential Model We now plot y = 1.624 (1.306) x, our exponential model, on the original scatter diagram This is a better fit to the data, but we need to be careful if we try to extrapolate

15 Part Two Power Models

16 Power Model Data ●We would now like to fit an power model y = a x b ●We would still like to use our least-squares linear regression techniques on this model ●If we take the logarithms of both sides, we get log y = log a + b log x because log(a x b ) = log(a) + log(x b ) = log a + b log x

17 Power Function to Linear Transform ●We modify this transformed equation log y = log a + x log b ●Define these new variables  Y = log y  A = log a  B = log b  X = x ●Then this equation becomes Y = A + B X

18 Least Squares on Power Model ●We started with a power model y = a b x ●We transformed that into a linear model Y = A + B X ●After we solve the linear model, we find that  b = B  a = 10 A ●In this way, we are able to use the method of least-squares to find a power model

19 Harley Davidson Dataset Year (x) Closing Price (y) 1990 1.1609 1991 2.6988 1992 4.5381 1993 5.3379 1994 6.8032 1995 7.0328 1996 11.5585 Year (x) Closing Price (y) 1997 13.4799 1998 23.5424 1999 31.9342 2000 39.7277 2001 54.31 2002 46.20 2003 47.53 2004 60.75

20 Power Function Example The scatter diagram below appears to be exponential (curved) and not linear A line is not an appropriate model

21 Fitting a Power Function Model We use Y = log y and X = log x  The first observation is x = 1 and y = 1.1609, thus the first observation of the transformed data is X = log 1 = 0 and Y = log 1.1609 = 0.0648  The second observation is x = 2 and y = 2.6988, thus the second observation of the transformed data is X = log 2 =.3010 and Y = log 2.6988 = 0.4312  We continue and take logs of all of the x values and all the y values

22 Using your Calculator To get the scatter plot we inputted x-values into L1 and the y-values into L2 To change the x-values into logs we go to the top of L3 and hit LOG(L1) ENTER and then repeat using L4 and the y-values (L2). Then use LINREG to find a and b (first part of the slide after next) Or a simpler way yet, use the PwrReg calculation under STAT and CALC and get it directly without having to convert back (last line of the slide after next)

23 Transformed Line The scatter diagram of the transformed data (Y and X) is more linear We now calculate least-squares regression line for this data

24 Least Squares to Power ●The least squares line is Y = 1.5252 X – 0.0928  B = 1.5252  A = –0.0928 ●This is transformed back to  b = B = 1.5252 and  a = 10 A = 0.8076, so y = 0.8076 x 1.5252

25 Power Model We now plot y = 0.8076 x 1.5252, our power model, on the original scatter diagram This is a better fit to the data, but we need to be careful if we try to extrapolate

26 Summary and Homework Summary –Transformations can enable us to construct certain nonlinear models –Exponential models, or y = a b x, can be created using least-squares techniques after taking logarithms of both sides –Power models, or y = a x b, can also be created using least-squares techniques after taking logarithms of both sides Homework


Download ppt "Lesson 4 - 4 Nonlinear Regression: Transformations."

Similar presentations


Ads by Google