35
Fitting Curves to Data Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Learning, Inc. Chapter 5: Chapter 5: Fitting Curves to Fitting Curves to Data Data Terry Dielman Terry Dielman Applied Regression Applied Regression Analysis: Analysis: A Second Course in Business and A Second Course in Business and Economic Statistics, fourth Economic Statistics, fourth edition edition

Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Embed Size (px)

Citation preview

Page 1: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 11Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Chapter 5:Chapter 5:

Fitting Curves to DataFitting Curves to DataTerry DielmanTerry Dielman

Applied Regression Analysis:Applied Regression Analysis:A Second Course in Business and A Second Course in Business and Economic Statistics, fourth editionEconomic Statistics, fourth edition

Page 2: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 22Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.1 Introduction5.1 Introduction

In Chapter 4 , the model was presented as:In Chapter 4 , the model was presented as:

where we assumed linear relationships where we assumed linear relationships between between y y and theand the x x variables.variables.

In this chapter we find that this may not be In this chapter we find that this may not be true and consider curvilinear relationships true and consider curvilinear relationships between the variables.between the variables.

ikikiii exxxy 22110

Page 3: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 33Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

ModelingModeling In general, we regress Y on some In general, we regress Y on some

X which is not a linear function.X which is not a linear function.

Common functions are XCommon functions are X22 , 1/X , 1/X or log(X) or log(X)

In economics, sometimes regress In economics, sometimes regress log(y) on log(x) log(y) on log(x)

Page 4: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 44Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.2 Fitting Curvilinear Relationships5.2 Fitting Curvilinear Relationships

Polynomial Regression – a common Polynomial Regression – a common correction for nonlinearity is to add correction for nonlinearity is to add powers of the explanatory variablepowers of the explanatory variable

In practice a second-order model is In practice a second-order model is often sufficient to describe the often sufficient to describe the relationshiprelationship

ikikiii exxxy 2

210

Page 5: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 55Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Example 5.1: TelemarketingExample 5.1: Telemarketing

n = 20 telemarketing employeesn = 20 telemarketing employees

Y = average calls per day over 20 Y = average calls per day over 20 workdaysworkdays

X = Months on the jobX = Months on the job

Data set TELEMARKET5Data set TELEMARKET5

Page 6: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 66Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Plot of Calls versus MonthsPlot of Calls versus Months

302010

35

30

25

20

MONTHS

CA

LL

S

There is an increase in calls with experience, but the rate of increase slows over time.

Page 7: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 77Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Fit of a First-Order ModelFit of a First-Order Model

For comparison purposes, we first fit For comparison purposes, we first fit the linear equation and obtained:the linear equation and obtained:

CALLS = 13.6708 + .7435 MONTHSCALLS = 13.6708 + .7435 MONTHS

This equation, which has an RThis equation, which has an R22 of of 87.4%, implies that each month of 87.4%, implies that each month of experience leads to .7435 more calls experience leads to .7435 more calls per day.per day.

Page 8: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 88Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Fitting a Second-Order ModelFitting a Second-Order Model

302010

35

30

25

20

MONTHS

CA

LL

S

S = 1.00325 R-Sq = 96.2 % R-Sq(adj) = 95.8 %

- 0.0401182 MONTHS**2

CALLS = -0.140471 + 2.31020 MONTHS

Regression Plot

Page 9: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 99Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Regression OutputRegression OutputRegression Analysis: CALLS versus MONTHS, MonthSQ

The regression equation isCALLS = - 0.14 + 2.31 MONTHS - 0.0401 MonthSQ

Predictor Coef SE Coef T PConstant -0.140 2.323 -0.06 0.952MONTHS 2.3102 0.2501 9.24 0.000MonthSQ -0.040118 0.006333 -6.33 0.000

S = 1.003 R-Sq = 96.2% R-Sq(adj) = 95.8%

Analysis of Variance

Source DF SS MS F PRegression 2 437.84 218.92 217.50 0.000Residual Error 17 17.11 1.01Total 19 454.95

Page 10: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1010Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Hypothesis Test on Hypothesis Test on 22HH00: : 2 2 = 0 = 0 (Use the linear equation)(Use the linear equation)

HHaa: : 2 2 ≠ 0 ≠ 0 (Quadratic has improved fit)(Quadratic has improved fit)

Test as usual with t = bTest as usual with t = b22/SE(b/SE(b22))

Here t = -.0402/.00633 = -6.33 is Here t = -.0402/.00633 = -6.33 is significant with p-value = .000significant with p-value = .000

Not surprising since RNot surprising since R22 increased 9% increased 9%

Page 11: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1111Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Hypothesis Tests "Top Down"Hypothesis Tests "Top Down"

The usual practice is to keep lower-The usual practice is to keep lower-order terms when a high-order term order terms when a high-order term is significant.is significant.

In In bb00 + b + b11 x + b x + b22 x x2 2 we would retain we would retain the the bb11 term even if it had an term even if it had an insignificant t-ratio, if the insignificant t-ratio, if the bb22 term term was significant.was significant.

Page 12: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1212Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Higher and higher?Higher and higher?

To see if the polynomial has even a To see if the polynomial has even a higher order, we fit a cubic equation.higher order, we fit a cubic equation.

The table below shows the second-The table below shows the second-order model was sufficient.order model was sufficient.

ModelModel p for highest p for highest order termorder term

RR22 Adj RAdj R22 SSee

LinearLinear 0.0000.000 87.4%87.4% 86.7%86.7% 1.7871.787

QuadraticQuadratic 0.0000.000 96.2%96.2% 95.8%95.8% 1.0031.003

CubicCubic 0.5090.509 96.3%96.3% 95.7%95.7% 1.0201.020

Page 13: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1313Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Centering the XCentering the X

When polynomial regression is used, When polynomial regression is used, multicollinearity often results multicollinearity often results because x and xbecause x and x2 2 are correlated.are correlated.

This can be eliminated by subtracting This can be eliminated by subtracting x-bar (the mean) from each xx-bar (the mean) from each x

2andUse )x(xxx

Page 14: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1414Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.2.2 Reciprocal Transformation of the 5.2.2 Reciprocal Transformation of the xx Variable Variable

Another curvilinear relationship that Another curvilinear relationship that is in common use is:is in common use is:

Here Here yy and and xx are inversely related are inversely related but the relationship is not linear.but the relationship is not linear.

ii

i ex

y

110

Page 15: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1515Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Example 5.2Example 5.2

We are interested in the relationship We are interested in the relationship between gas mileage and a car's between gas mileage and a car's horsepower.horsepower.

An the next page is a plot of the An the next page is a plot of the highway mpg (HWYMPG) and highway mpg (HWYMPG) and horsepower (HP) for 147 cars listed in horsepower (HP) for 147 cars listed in the October 2002 the October 2002 Road and TrackRoad and Track..

Page 16: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1616Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

7006005004003002001000

70

60

50

40

30

20

10

HP

HW

YM

PG

Highway MPG versus HorsepowerHighway MPG versus Horsepower

Page 17: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1717Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Modeling the RelationshipModeling the Relationship A regression of HWYMPG on HP yieldsA regression of HWYMPG on HP yields

HWYMPG = 38.73 - .0477 HP with RHWYMPG = 38.73 - .0477 HP with R22 = 59.4% = 59.4%

This does not fit too well because as This does not fit too well because as horsepower increases, mileage decreases, horsepower increases, mileage decreases, but the rate of decrease is slower for but the rate of decrease is slower for more-powerful cars.more-powerful cars.

Although other models, including a Although other models, including a quadratic, might work, we regressed quadratic, might work, we regressed HWYMPG on 1/HP.HWYMPG on 1/HP.

Page 18: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1818Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Regression ResultsRegression Results

The regression equation isHWYMPG = 13.6 + 2692 HPINV

Predictor Coef SE Coef T PConstant 13.6310 0.6493 20.99 0.000HPINV 2962.4675 111.7526 24.09 0.000

S = 2.93107 R-Sq = 80.0% R-Sq(adj) = 79.9%

Analysis of Variance

Source DF SS MS F PRegression 1 4987.0 4987.0 580.48 0.000Residual Error 145 1245.1 8.6Total 146 6232.7

Page 19: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 1919Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

7006005004003002001000

70

60

50

40

30

20

10

HP

HW

YM

PG

Data and Reciprocal FitData and Reciprocal Fit

Page 20: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2020Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.2.3 Log Transformation of the 5.2.3 Log Transformation of the xx Variable Variable

Yet another curvilinear equation is:Yet another curvilinear equation is:

where ln(where ln(xx) is the natural logarithm ) is the natural logarithm of of xx..

It is assumed that the It is assumed that the xx values are values are positive because ln(0) is undefined.positive because ln(0) is undefined.

iii exy )ln(10

Page 21: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2121Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Example 5.4 Fuel ConsumptionExample 5.4 Fuel Consumption

n = 51 (50 states plus Washington, D.C.)n = 51 (50 states plus Washington, D.C.)

FUELCON = fuel consumption per capitaFUELCON = fuel consumption per capita

POP = state populationPOP = state population

AREA = area of state in square milesAREA = area of state in square miles

POPDENS = population densityPOPDENS = population density

Data Set FUELCON5Data Set FUELCON5

Page 22: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2222Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

1000050000

700

600

500

400

300

DENSITY

FU

EL

CO

NPlot of Fuelcon versus DensityPlot of Fuelcon versus Density

r = -.454

Page 23: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2323Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Effect of the TransformationEffect of the Transformation

The graph has one point (D.C.) on The graph has one point (D.C.) on the right with all others clumped to the right with all others clumped to the left.the left.

It is hard to see what type of It is hard to see what type of relationship there is until some relationship there is until some adjustments are made.adjustments are made.

Here take the natural log of density Here take the natural log of density to "pull" the extreme point back in.to "pull" the extreme point back in.

Page 24: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2424Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

9876543210

700

600

500

400

300

LogDensity

FU

EL

CO

NConsumption versus LogdensityConsumption versus Logdensity

r = -.527

Page 25: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2525Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Linear and Log RegressionsLinear and Log Regressions

The regression equation isFUELCON = 495 - 0.025 DENSITY

Predictor Coef SE Coef T PConstant 465.628 9.481 52.28 0.000DENSITY -0.025 0.007 -3.56 0.001

S = 65.1675 R-Sq = 20.6% R-Sq(adj) = 19.0%

The regression equation isFUELCON = 597 – 24.5 LOGDENS

Predictor Coef SE Coef T PConstant 597.19 29.96 22.15 0.000LOGDENS -24.53 5.65 -4.34 0.000

S = 62.1561 R-Sq = 27.8% R-Sq(adj) = 26.3%

Page 26: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2626Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.2.4 Log Transformations of Both the 5.2.4 Log Transformations of Both the yy and and xx Variables Variables

Here the natural log of Here the natural log of yy is the dependent is the dependent variable and the natural log of variable and the natural log of xx is the is the independent variable:independent variable:

Comparing results with other models may Comparing results with other models may be difficult since we are not modeling be difficult since we are not modeling yy itself. itself.

Economists sometimes use this to Economists sometimes use this to estimate price elasticity (estimate price elasticity (y y is demand andis demand and x x price; price; bb11 is estimated elasticity). is estimated elasticity).

iii exy )ln()ln( 10

Page 27: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2727Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Example 5.4 Imports and GDPExample 5.4 Imports and GDP

The gross domestic product (GDP) and The gross domestic product (GDP) and dollar amount of total imports dollar amount of total imports (IMPORTS) for 25 countries was (IMPORTS) for 25 countries was obtained from the World Fact Book.obtained from the World Fact Book.

For both variables, low values clump For both variables, low values clump together and higher values spread together and higher values spread out, suggesting log transformations out, suggesting log transformations for both.for both.

Page 28: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2828Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

1000050000

1000

500

0

GDP

IMP

OR

TS

Scatterplot of Imports vs GDPScatterplot of Imports vs GDP

Page 29: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 2929Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

1050

7

6

5

4

3

2

1

0

-1

-2

LogGDP

Lo

gIm

p

Scatterplot of LogImp vs LogGDPScatterplot of LogImp vs LogGDP

Page 30: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3030Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Two Regression ModelsTwo Regression Models

Regression Analysis: IMPORTS versus GDP

Predictor Coef SE Coef T PConstant 22.32 19.24 1.16 0.258GDP 0.105671 0.008452 12.50 0.000

S = 87.00 R-Sq = 87.2% R-Sq(adj) = 86.6%

Regression Analysis: LogImp versus LogGDP

Predictor Coef SE Coef T PConstant -1.1275 0.4346 -2.59 0.016LogGDP 0.86703 0.07877 11.01 0.000

S = 0.9142 R-Sq = 84.0% R-Sq(adj) = 83.4%

Not directly comparable

Page 31: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3131Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

The RThe R22 Compare Different Things Compare Different Things

The 87.2 % RThe 87.2 % R22 for the no-log model is for the no-log model is the percentage of variation in the percentage of variation in ImportsImports explained. explained.

The 84.0% for the second model is The 84.0% for the second model is the percentage of variation in the percentage of variation in ln(Imports)ln(Imports) explained. explained.

If you converted the fitted values of If you converted the fitted values of the second model back to Imports the second model back to Imports you might find the log model better.you might find the log model better.

Page 32: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3232Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

What Transformation to UseWhat Transformation to Use

It is probably best to try several.It is probably best to try several. A quadratic is most flexible because A quadratic is most flexible because

it uses two parameters to fit the it uses two parameters to fit the relationship between to fit the relationship between to fit the relationship between relationship between yy and and xx..

Some further analysis is in Chapter 6 Some further analysis is in Chapter 6 where tests for nonlinearity are where tests for nonlinearity are discussed.discussed.

Page 33: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3333Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

5.2.5 Fitting Curved Trends5.2.5 Fitting Curved Trends

If the data is collected over time, we If the data is collected over time, we may want to consider variations on may want to consider variations on the linear trend model of Chapter 3.the linear trend model of Chapter 3.

Another is the S-Curve trend:Another is the S-Curve trend:

tt etty 2210:trendQuadratic

tt et

y1

exp 10

Page 34: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3434Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

S Curve ModelS Curve Model

Many products have a demand curve Many products have a demand curve like this.like this.

1.1. Initial demand increases slowlyInitial demand increases slowly

2.2. As product matures, demand picks up As product matures, demand picks up and steadily grows.and steadily grows.

3.3. At some saturation point demand At some saturation point demand levels off.levels off.

Page 35: Fitting Curves to Data 1 Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 5: Fitting Curves to Data Terry Dielman Applied Regression

Fitting Curves to DataFitting Curves to Data 3535Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.Copyright © 2005 Brooks/Cole, a division of Thomson Learning, Inc.

Exponential Growth ModelExponential Growth Model

Another alternative is an exponential Another alternative is an exponential trend:trend:

This can be fit by least squares if you This can be fit by least squares if you model ln(model ln(yy).).

tt ety 10exp