Upload
raymond-hutchinson
View
220
Download
0
Embed Size (px)
Citation preview
M25- Growth & Transformations 1 Department of ISM, University of Alabama, 1992-2003
Lesson Objectives:
• Recognize exponential growth or decay.
• Use log(Y ) to construct the prediction equation.
• Reverse the process to get predicted values from log(Y ) models back in terms of Y.
M25- Growth & Transformations 2 Department of ISM, University of Alabama, 1992-2003
L
wt
h
n e ar
g r o
i
E x p o n en
ti
a
l
M25- Growth & Transformations 3 Department of ISM, University of Alabama, 1992-2003
Stuff $100 in a mattress each month,then after X months you will haveY = 0 + 100 X dollars.
This is linear growth; ZERO interest.
X
Y
Example 1
M25- Growth & Transformations 4 Department of ISM, University of Alabama, 1992-2003
Stuff $1000 in a savings acct.that pays 10% interest each year,
then after X years you will haveY = 1000 ( 1.10 ) dollars.
X
This is exponential growth.
X
Y
Example 2
M25- Growth & Transformations 5 Department of ISM, University of Alabama, 1992-2003
Linear growth increases by a fixed amount in each time period; Exponential growth increases by afixed percentage of the previoustotal.
M25- Growth & Transformations 6 Department of ISM, University of Alabama, 1992-2003
If YY grows exponentially grows exponentially as X increases,
X
Y
then log log YY grows linearly grows linearly as X increases.
X
log Y
M25- Growth & Transformations 7 Department of ISM, University of Alabama, 1992-2003
logb X = YY bYY = X
Properties of logarithms:
1. logbase 1 = 0
2. logb XY = logb X + logb Y
3. logb Xp = p logb X
A logarithm is an exponent.A logarithm is an exponent.
M25- Growth & Transformations 8 Department of ISM, University of Alabama, 1992-2003
logb X = Y
Review of logarithms:
bY = X
log5 125 = 3 53 = 125
log101000 = 3 103 = 1000
ln X = natural log, or log base “e”e = 2.7182818
ln 1000 = 6.907 e6.907 = 1000
M25- Growth & Transformations 9 Department of ISM, University of Alabama, 1992-2003
Why do we care about logarithms?
Back to the matress.Back to the matress.$1000. at 10% per year:$1000. at 10% per year:
ln Y = ln [1000 ( 1.10 )X]
= ln [1000] + ln( 1.10 )X
= ln [1000] + X ln( 1.10 )
= a + b X i.e., a straight linestraight line.
Not linear
equation!Not linear
equation!
Y = 1000 ( 1.10 )X
This IS a linearequation!
This IS a linearequation!
X
048
12
Y
110
1001000
500
1000
4 8 12 X-axis
Y
log10 Y
4 8 12 X
3
2
1
log Y
Example 3
M25- Growth & Transformations 12 Department of ISM, University of Alabama, 1992-2003
If X = 6, log10 Y = 0 + .25 6= 1.51.5
If log10 Y = 1.5,
Y =
log10 Y = 0 + .25 X
4 8 12 X
3
2
1
log Y
Example 3
M25- Growth & Transformations 13 Department of ISM, University of Alabama, 1992-2003
If X = 10, log10 Y = 0 + .25 10=
Y =4 8 12 X
3
2
1
log Y
Example 3
M25 Expon growth & Transforms 14 Department of ISM, University of Alabama, 1992-2003
Data
TransformationsData
Transformations
M25 Expon growth & Transforms 15 Department of ISM, University of Alabama, 1992-2003
Ex: Z-scores, inches to cm, oC to oF temperature
The basic shape of the data distribution does not change.
Linear transformations of Y and/or X
do not affect r.
do not change the pattern of the relationship.
M25 Expon growth & Transforms 16 Department of ISM, University of Alabama, 1992-2003
transform a skewed distributioninto a symmetric distribution,
straighten a nonlinear relationshipbetween two variables,
remove non-constant variance,
Nonlinear transformations can be used to:
M25- Growth & Transformations 17 Department of ISM, University of Alabama, 1992-2003
Lesson Objectives: Learn how to recognize whena straight line is NOT the best fitthe pattern of the data.
Learn how to transform one or both of the variables to create a linear pattern.
Learn to use the transformed model to get estimates back in terms of the original Y variable.
M25 Expon growth & Transforms 18 Department of ISM, University of Alabama, 1992-2003
What do we do if the relationship between Y
and X is not linear?
Always scatterplot the data first!
If the relationship is linear, then the model may produce reasonable estimates.
M25- Growth & Transformations 19 Department of ISM, University of Alabama, 1992-2003
“Curved lines” can be straightened out by changing the form of a variable:
1.1. Replace “Replace “XX” with “” with “square root of square root of XX””
2.2. Replace “Replace “XX” with “” with “log log XX””
3.3. Replace “Replace “XX” with “” with “1/1/XX”, its inverse.”, its inverse.
Each step Each step downdown this list this list increasesincreasesthe “change in the bend of the line.”the “change in the bend of the line.”
M25- Growth & Transformations 20 Department of ISM, University of Alabama, 1992-2003
““New New XX ” = ” = XX
ppp = 1p = 1
p = .5p = .5
p = -1p = -1
p = #p = #
p = 2p = 2
Square root
Inverse or reciprocal
logarithm
Changing the power, changes the bend:Changing the power, changes the bend:
Each step Each step downdown this list this list increasesincreasesthe “change in the bend of the line.”the “change in the bend of the line.”
M25- Growth & Transformations 21 Department of ISM, University of Alabama, 1992-2003
X
X
ln X
1/X
X
X
ln X
1/X
YY
YY
ln Yln Y
1/Y1/Y
Y
Y
ln Y
1/Y
X
Y
Original patternOriginal pattern
Original patternOriginal pattern Original patternOriginal pattern
YY = a + b = a + b11X + bX + b22XX22
Rules of Engagement
Original patternOriginal pattern
b2 > 0
b2 < 0
or
M25- Growth & Transformations 22 Department of ISM, University of Alabama, 1992-2003
Y = Federal expenditures on social insurance, in millions. X = Year
X 1960 1965 1970 1975 1980Y 14,307 21,807 45,246 99,715 191,162
a. plotb. fix data if necessaryc. get prediction equationd. predict for 2000.
Example 4
M25- Growth & Transformations 23 Department of ISM, University of Alabama, 1992-2003
40
80
120
160
200
‘60 ‘65 ‘70 ‘75 ‘80
Example 4, continued
M25- Growth & Transformations 24 Department of ISM, University of Alabama, 1992-2003
X
19601965197019751980
Y
14,30721,80745,24699,715
191,162
log10Y
4.1564.3394.6564.9995.281
log10 Y =
Example 4, continued
M25- Growth & Transformations 25 Department of ISM, University of Alabama, 1992-2003
Y
40
80
120
160
200
‘60 ‘65 ‘70 ‘75 ‘80 ‘60 ‘65 ‘70 ‘75 ‘80
4.0
4.4
4.8
5.2
log Y
Example 4, continued
M25- Growth & Transformations 26 Department of ISM, University of Alabama, 1992-2003
For 2000,
log10 Y = -110.04 + .05824 (2000)= ____________
log10Y = -110.04 + .05824 X
Y = 106.44006.4400
=
This is an exponent.
M25- Growth & Transformations 27 Department of ISM, University of Alabama, 1992-2003
Example 4, in MinitabExample 4, in MinitabGraph
Plot …
Title
ScatterplotScatterplot
M25- Growth & Transformations 28 Department of ISM, University of Alabama, 1992-2003
198019701960
200000
100000
0
Year
Exp
end
Social Ins. Fed Expenditures (millions $)
Plot shows severe curve.
Example 4, in MinitabExample 4, in Minitab ScatterplotScatterplot
M25- Growth & Transformations 29 Department of ISM, University of Alabama, 1992-2003
Stat
Regression
Fitted Line Plot …
YY = a + b = a + bXX
Example 4, in MinitabExample 4, in Minitab RegressionRegression
M25- Growth & Transformations 30 Department of ISM, University of Alabama, 1992-2003
198019701960
200000
100000
0
Year
Exp
end
S = 30940.5 R-Sq = 86.6 % R-Sq(adj) = 82.2 %
Expend = -16931302 + 8632.36 Year
Regression Plot
Straight linedoes not fitthe data verywell.Future yearsFuture yearswill be severelywill be severelyunderestimated!underestimated!
Same plot as before,with regression line overlayed.
Example 4, in MinitabExample 4, in Minitab RegressionRegression
M25- Growth & Transformations 31 Department of ISM, University of Alabama, 1992-2003
Stat
Regression
Fitted Line Plot …
loglog1010YY = a + b = a + bXX
Example 4, in MinitabExample 4, in Minitab
This boxcontrolsthe “scale”of the plot.
M25- Growth & Transformations 32 Department of ISM, University of Alabama, 1992-2003
198019701960
200000
100000
0
Year
Exp
end
S = 0.0497219 R-Sq = 99.1 % R-Sq(adj) = 98.8 %
log(Expend) = -110.042 + 0.0582374 Year
Regression Plot
Result from equation must be “un-logged”: y = 10log(Expend)
Advantage: Can see the “new curved line” drawn through the original data.Disadvantage: Hard to tell if the fit is “good enough”.
Advantage: Can see the “new curved line” drawn through the original data.Disadvantage: Hard to tell if the fit is “good enough”.
Example 4, in MinitabExample 4, in Minitab “Logscale” boxNOT checked:Axes are stillY and X, butcurve is basedon the “log Y”.
M25- Growth & Transformations 33 Department of ISM, University of Alabama, 1992-2003
Stat
Regression
Fitted Line Plot …
loglog1010YY = a + b = a + bXX
Example 4, in MinitabExample 4, in Minitab
The boxIS checked.
M25- Growth & Transformations 34 Department of ISM, University of Alabama, 1992-2003
198019701960
200000
150000
100000
80000
60000
40000
30000
20000
15000
Year
Exp
end
S = 0.0497219 R-Sq = 99.1 % R-Sq(adj) = 98.8 %
log(Expend) = -110.042 + 0.0582374 Year
Regression Plot
10,000
50,000
Advantage: Easier to see that the curve has been straightened.Disadvantage: Harder to read the scale.
Advantage: Easier to see that the curve has been straightened.Disadvantage: Harder to read the scale.
Results must be “un-logged”: y = 10log(Expend)
Example 4, in MinitabExample 4, in Minitab “Logscale” boxIS checked:Axes are “log Y”and X, but values onthe “log Y” scaleare “un-logged.”
5.2
4.8
4.6
4.4
4.2
4.0
Log scale
Un-Logged Y scale
M24 Std Error & r-square 35 Department of ISM, University of Alabama, 1992-2003
How helpful is “engine size” for estimating “mpg”?
Example 5
Continued . .
. .
Continued . .
. .
M24 Std Error & r-square 36 Department of ISM, University of Alabama, 1992-2003
Analysis DiaryStep Y X s r-sqr Comments
1 mpg displace 2.880 54.6%
Slope of “displacement” in not zero; but plot indicates a curvedpattern.Transform a variable and re-run.
Example 5 “mpg_city” versus engine “displacement”
2 to be done in next section. RecallRecall
M24 Std Error & r-square 37 Department of ISM, University of Alabama, 1992-2003
How helpful is engine size for estimating mpg?
Regression Analysis
The regression equation ismpg_city = 29.3 - 0.0480 displace
113 cases used 4 cases contain missing valuesPredictor Coef StDev T P
Constant 29.2651 0.7076 41.36 0.000displace 0.047967 0.004154 -11.55 0.000
S = 2.880 R-Sq = 54.6% R-Sq(adj) = 54.2%
Analysis of VarianceSource DF SS MS F PRegression 1 1106.1 1106.1 133.33 0.000Error 111 920.8 8.3Total 112 2026.9
displacement in cubic in.mpg_city in ??? Data in Car89 Data
P-value: a measure of the likelihoodthat the true coefficient is “zero.”
Example 5
M24 Std Error & r-square 38 Department of ISM, University of Alabama, 1992-2003
mpg_city vs. displacementmpg_city vs. displacement
35025015050
35
30
25
20
15
displace
mpg
_city
S = 2.88 Is this a good fit? The data pattern appears curved; we can do better!
Example 5
Step 1YY = a + b = a + bXX
X
X
ln X
1/X
X
X
ln X
1/X
YY
YY
ln Yln Y
1/Y1/Y
Y
Y
ln Y
1/Y
X
Y
Original patternOriginal pattern
Original patternOriginal pattern Original patternOriginal pattern
YY = a + b = a + b11X + bX + b22XX22
Rules of Engagement
Original patternOriginal pattern
b2 > 0
b2 < 0
or
M24 Std Error & r-square 40 Department of ISM, University of Alabama, 1992-2003
350250150 50
40
30
20
displace
mp
g_
city
S = 0.0527122 R-Sq = 58.9 % R-Sq(adj) = 58.5 %
log(mpg_city) = 1.47973 - 0.0009579 displace
Regression Plot
mpg_city vs. displacementmpg_city vs. displacementExample 5
Step 2
log Y
X
loglog1010YY = a + b = a + bXX
“Logscale” boxIS checked:
M24 Std Error & r-square 41 Department of ISM, University of Alabama, 1992-2003
Analysis DiaryStep Y X s r-sqr Comments
1 mpg displace 2.880 54.6%
Slope of “displacement” in not zero; but plot indicates a curvedpattern.Transform a variable and re-run.
Example 5 “mpg_city” versus engine “displacement”
2 log Y X 58.9%
Still curved, in same direction.
M24 Std Error & r-square 42 Department of ISM, University of Alabama, 1992-2003
300200150100 90 80 70 60
40
30
20
displace
mp
g_
city
S = 0.0462544 R-Sq = 68.3 % R-Sq(adj) = 68.0 %
log(mpg_city) = 2.20505 - 0.404870 log(displace)
Regression Plot
mpg_city vs. displacementmpg_city vs. displacementExample 5
Step 3
log Y
log X
loglog1010YY = a + b log = a + b log1010XX
Both “Logscale”boxes checked:
M24 Std Error & r-square 43 Department of ISM, University of Alabama, 1992-2003
Analysis DiaryStep Y X s r-sqr Comments
1 mpg displace 2.880 54.6%
Slope of “displacement” in not zero; but plot indicates a curvedpattern.Transform a variable and re-run.
Example 5 “mpg_city” versus engine “displacement”
2 log Y X 58.9%
Still curved, same direction.
3 log Y log X 68.3%
Better fit possible on left end?
M24 Std Error & r-square 44 Department of ISM, University of Alabama, 1992-2003
350250150 50
35
25
15
displace
mp
g_
city
S = 2.34002 R-Sq = 70.3 % R-Sq(adj) = 69.7 %
+ 0.0003536 displace**2
mpg_city = 40.6380 - 0.185449 displace
Regression Plot
mpg_city vs. displacementmpg_city vs. displacementExample 5
Step 4
Y
X
Try:Y = a + b1X+ b2X2
M24 Std Error & r-square 45 Department of ISM, University of Alabama, 1992-2003
Analysis DiaryStep Y X s r-sqr Comments
1 mpg displace 2.880 54.6%
Slope of “displacement” in not zero; but plot indicates a curvedpattern.Transform a variable and re-run.
Example 5 “mpg_city” versus engine “displacement”
2 log Y X 58.9%
Still curved, same direction.
3 log Y log X 68.3%
Better fit possible on left end?
4 Y = a +b1X+b2X2 70.3%
Better fit; BUT illogical!Try inverse of Y.
M24 Std Error & r-square 46 Department of ISM, University of Alabama, 1992-2003
Calc
Calculator …
Name of “New Y variable.”Name of “New Y variable.”
mpg_city vs. displacementmpg_city vs. displacementExample 5
“right sideof the equation”
1/’mpg_city’
To change the functional form of a variablein Minitab:
List of namesof functions:
M24 Std Error & r-square 47 Department of ISM, University of Alabama, 1992-2003
350250150 50
0.07
0.06
0.05
0.04
0.03
displace
1/m
pg
_c
S = 0.0054520 R-Sq = 61.3 % R-Sq(adj) = 60.9 %
1/mpg_c = 0.0312912 + 0.0001042 displace
Regression Plotmpg_city vs. displacementmpg_city vs. displacementExample 5
Step 5Try:1/Y = a + b1X
1/ Y
X
Went too far.
M24 Std Error & r-square 48 Department of ISM, University of Alabama, 1992-2003
Analysis DiaryStep Y X s r-sqr Comments
1 mpg displace 2.880 54.6%
Slope of “displacement” in not zero; but plot indicates a curvedpattern.Transform a variable and re-run.
Example 5 “mpg_city” versus engine “displacement”
2 log Y X 58.9%
Still curved, same direction.
3 log Y log X 68.3%
Better fit possible on left end?
4 Y = a +b1X+b2X2 70.3%
Better fit; BUT illogical!Try inverse of Y.
5 1/ Y X 61.3%
Too far; bent in otherdirection; NOT a good fit.etc.
M24 Std Error & r-square 49 Department of ISM, University of Alabama, 1992-2003
mpg_city vs. displacementmpg_city vs. displacementExample 5
Final model:Final model:
log(mpg_city) = 2.2051 - 0.4049 log(displace)
s = 0.04625 R-Sq = 68.3%Estimate “mean mpg_city” for displacement = 150.
Log10 150.0 =
log(mpg_city) = 2.2051 - 0.4049 ( _______ ) = _______
mpg_city = = 21.086 mpg21.086 mpg.________
M24 Std Error & r-square 50 Department of ISM, University of Alabama, 1992-2003
300200150100 90 80 70 60
40
30
20
displace
mp
g_
city
S = 0.0462544 R-Sq = 68.3 % R-Sq(adj) = 68.0 %
log(mpg_city) = 2.20505 - 0.404870 log(displace)
Regression Plot
mpg_city vs. displacementmpg_city vs. displacementExample 5
Back to Step 3
log Y
log X
loglog1010YY = a + b log = a + b log1010XX
Both “Logscale”boxes checked:
Recall
150
21.09
M25 Expon growth & Transforms 51 Department of ISM, University of Alabama, 1992-2003
Example:
MPG vs HP for32 Car Models
Example 6
M25 Expon growth & Transforms 52 Department of ISM, University of Alabama, 1992-2003
230210190170150130110907050
30
25
20
15
HP
GPM
Scatterplot of MPG vs Horsepower
for 32 Car Models
Non-Linear Relationship
Example 6
Step 1
Y
X
X
X
ln X
1/X
X
X
ln X
1/X
YY
YY
ln Yln Y
1/Y1/Y
Y
Y
ln Y
1/Y
X
Y
Original patternOriginal pattern
Original patternOriginal pattern Original patternOriginal pattern
YY = a + b = a + b11X + bX + b22XX22
Rules of Engagement
Original patternOriginal pattern
b2 > 0
b2 < 0
or
M25 Expon growth & Transforms 54 Department of ISM, University of Alabama, 1992-2003
0.0150.0100.005
30
25
20
15
1/HP
GPM
Plot of MPG vs 1/HP for 32 Car Models
Example 6
Step 4
Y
1/X
M25 Expon growth & Transforms 55 Department of ISM, University of Alabama, 1992-2003
MPG = a + b 1HP
Suggests a model of the form:
Example 6
M25 Expon growth & Transforms 56 Department of ISM, University of Alabama, 1992-2003
Example:
Price vs Weight for109 Car Models
Example 7
M25 Expon growth & Transforms 57 Department of ISM, University of Alabama, 1992-2003
400030002000
60000
50000
40000
30000
20000
10000
0
WEIGHT
ECI
RP
Plot of Price vs Weight for 109 Car Models
Example 7
Step 1
Y
X
M25 Expon growth & Transforms 58 Department of ISM, University of Alabama, 1992-2003
400030002000
60000
50000
40000
30000
20000
10000
0
WEIGHT
ECI
RP
Plot of Price vs Weight for 109 Car Models
Nonlinear with Nonconstant Variance
Example 7
Step 1
Y
X
X
X
ln X
1/X
X
X
ln X
1/X
YY
YY
ln Yln Y
1/Y1/Y
Y
Y
ln Y
1/Y
X
Y
Original patternOriginal pattern
Original patternOriginal pattern Original patternOriginal pattern
YY = a + b = a + b11X + bX + b22XX22
Rules of Engagement
Original patternOriginal pattern
b2 > 0
b2 < 0
or
M25 Expon growth & Transforms 60 Department of ISM, University of Alabama, 1992-2003
Non-Constant Variance
The variation of the Y values increases as X changes.
Generally,transform the Y variable first.
“Log Y” is a reasonable start.
M25 Expon growth & Transforms 61 Department of ISM, University of Alabama, 1992-2003
400030002000
0.0002
0.0001
0.0000
WEIGHT
ECI
RP/1
Plot of 1/Price vs Weight for 109 Car Models
Constant Variance, but still nonlinear Transform WEIGHT
Example 7
Step 3
1/ Y
X
X
X
ln X
1/X
X
X
ln X
1/X
YY
YY
ln Yln Y
1/Y1/Y
Y
Y
ln Y
1/Y
X
Y
Original patternOriginal pattern
Original patternOriginal pattern Original patternOriginal pattern
YY = a + b = a + b11X + bX + b22XX22
Rules of Engagement
Original patternOriginal pattern
b2 > 0
b2 < 0
or
M25 Expon growth & Transforms 63 Department of ISM, University of Alabama, 1992-2003
0.00060.00050.00040.00030.0002
0.0002
0.0001
0.0000
1/WEIGHT
ECI
RP/1
Plot of 1/Price vs 1/Weight for 109 Car Models
Linear with constant variance! (outliers)
Example 7
Step 5
1/ Y
1/X
M25 Expon growth & Transforms 64 Department of ISM, University of Alabama, 1992-2003
Suggests a model of the form:
1Weight
= a + b 1
Priceor
Price = 1
a + b 1
Weight
Example 7
M25 Expon growth & Transforms 65 Department of ISM, University of Alabama, 1992-2003
M25 Expon growth & Transforms 66 Department of ISM, University of Alabama, 1992-2003
M25 Expon growth & Transforms 67 Department of ISM, University of Alabama, 1992-2003
Example:
Sales vs Assets for80 Fortune 500 Companies
in 1986
M25 Expon growth & Transforms 68 Department of ISM, University of Alabama, 1992-2003
50000400003000020000100000
50000
40000
30000
20000
10000
0
ASSETS
SELAS
Plot of Sales vs Assets for 80 Fortune 500 Companies
Example 8
Many small values,few large values;
compress both scales.
Step 1
Y
X
M25 Expon growth & Transforms 69 Department of ISM, University of Alabama, 1992-2003
4.53.52.5
5
4
3
2
LogAssts
selaSgoL
Plot of Log(Sales) vs Log(Assets) for 80 Fortune 500 Companies
Example 8 Step 2
Use brushingto identifythese points.
Treat thetwo groupsseparately?
log Y
log X
M25 Expon growth & Transforms 70 Department of ISM, University of Alabama, 1992-2003
Suggests a model of the form:
log(Sales) = a + b log(Assets)
or
Sales = 10a
Assetsb
Example 8
M25 Expon growth & Transforms 71 Department of ISM, University of Alabama, 1992-2003
WarningsWarnings
Data transformations do NOT work if there is no relationship in the original plot.
The transformations discussed (square root, log, reciprocal, etc.) are one-bend transformations.
Pattern having more than one bend need a different fix.
M25 Expon growth & Transforms 72 Department of ISM, University of Alabama, 1992-2003
The Endof regression analysis,
for now . . . .