Upload
shanon-byrd
View
222
Download
0
Tags:
Embed Size (px)
Citation preview
Lecture 3
Introduction to Multiple Regression
Business and Economic Forecasting
Chap 14-2Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-2
The Multiple Regression Model
Idea: Examine the linear relationship between 1 dependent (Y) & 2 or more independent variables (Xi)
ikik2i21i10iεXβXβXββY
Multiple Regression Model with k Independent Variables:
Y-intercept Population slopes Random Error
DCOVA
Chap 14-3Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-3
Multiple Regression Equation
The coefficients of the multiple regression model are estimated using sample data
kik2i21i10iXbXbXbbY ˆ
Estimated (or predicted) value of Y
Estimated slope coefficients
Multiple regression equation with k independent variables:
Estimatedintercept
In this lecture we will use Excel or STATA to obtain the regression slope coefficients and other regression
summary measures.
DCOVA
Chap 14-4Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-4
Two variable model
Y
X1
X2
22110 XbXbbY
Slope for v
ariable X 1
Slope for variable X2
Multiple Regression Equation(continued)
DCOVA
Chap 14-5Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-5
Example: 2 Independent Variables
A distributor of frozen dessert pies wants to evaluate factors thought to influence demand
Dependent variable: Pie sales (units per week) Independent variables: Price (in $)
Advertising ($100’s)
Data are collected for 15 weeks
DCOVA
Chap 14-6Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-6
Pie Sales Example
Sales = b0 + b1 (Price)
+ b2 (Advertising)
WeekPie
SalesPrice
($)Advertising
($100s)
1 350 5.50 3.3
2 460 7.50 3.3
3 350 8.00 3.0
4 430 8.00 4.5
5 350 6.80 3.0
6 380 7.50 4.0
7 430 4.50 3.0
8 470 6.40 3.7
9 450 7.00 3.5
10 490 5.00 4.0
11 340 7.20 3.5
12 300 7.90 3.2
13 440 5.90 4.0
14 450 5.00 3.5
15 300 7.00 2.7
Multiple regression equation:DCOVA
Chap 14-7Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-7
Excel Multiple Regression Output
Regression Statistics
Multiple R 0.72213
R Square 0.52148
Adjusted R Square 0.44172
Standard Error 47.46341
Observations 15
ANOVA df SS MS F Significance F
Regression 2 29460.027 14730.013 6.53861 0.01201
Residual 12 27033.306 2252.776
Total 14 56493.333
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 306.52619 114.25389 2.68285 0.01993 57.58835 555.46404
Price -24.97509 10.83213 -2.30565 0.03979 -48.57626 -1.37392
Advertising 74.13096 25.96732 2.85478 0.01449 17.55303 130.70888
ertising)74.131(Adv ce)24.975(Pri - 306.526 Sales
DCOVA
Chap 14-8Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-8
The Multiple Regression Equation
ertising)74.131(Adv ce)24.975(Pri - 306.526 Sales
b1 = -24.975: sales will decrease, on average, by 24.975 pies per week for each $1 increase in selling price, net of the effects of changes due to advertising
b2 = 74.131: sales will increase, on average, by 74.131 pies per week for each $100 increase in advertising, net of the effects of changes due to price
where Sales is in number of pies per week Price is in $ Advertising is in $100’s.
DCOVA
Chap 14-9Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-9
Using The Equation to Make Predictions
Predict sales for a week in which the selling price is $5.50 and advertising is $350:
Predicted sales is 428.62 pies
428.62
(3.5) 74.131 (5.50) 24.975 - 306.526
ertising)74.131(Adv ce)24.975(Pri - 306.526 Sales
Note that Advertising is in $100’s, so $350 means that X2 = 3.5
DCOVA
Chap 14-10Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-10
Coefficient of Multiple Determination
Reports the proportion of total variation in Y explained by all X variables taken together
squares of sum total
squares of sum regression
SST
SSRr 2
DCOVA
Chap 14-11Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-11
Regression Statistics
Multiple R 0.72213
R Square 0.52148
Adjusted R Square 0.44172
Standard Error 47.46341
Observations 15
ANOVA df SS MS F Significance F
Regression 2 29460.027 14730.013 6.53861 0.01201
Residual 12 27033.306 2252.776
Total 14 56493.333
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 306.52619 114.25389 2.68285 0.01993 57.58835 555.46404
Price -24.97509 10.83213 -2.30565 0.03979 -48.57626 -1.37392
Advertising 74.13096 25.96732 2.85478 0.01449 17.55303 130.70888
.5214856493.3
29460.0
SST
SSRr2
52.1% of the variation in pie sales is explained by the variation in price and advertising
Multiple Coefficient of Determination In Excel
DCOVA
Chap 14-12Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-12
Adjusted r2
r2 never decreases when a new X variable is added to the model This can be a disadvantage when comparing
models What is the net effect of adding a new variable?
We lose a degree of freedom when a new X variable is added
Did the new X variable add enough explanatory power to offset the loss of one degree of freedom?
DCOVA
Chap 14-13Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-13
Shows the proportion of variation in Y explained by all X variables adjusted for the number of X variables used
(where n = sample size, k = number of independent variables)
Penalize excessive use of unimportant independent variables
Smaller than r2
Useful in comparing among models
Adjusted r2
(continued)
1
1)1(1 22
kn
nrradj
DCOVA
Chap 14-14Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-14
Regression Statistics
Multiple R 0.72213
R Square 0.52148
Adjusted R Square 0.44172
Standard Error 47.46341
Observations 15
ANOVA df SS MS F Significance F
Regression 2 29460.027 14730.013 6.53861 0.01201
Residual 12 27033.306 2252.776
Total 14 56493.333
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 306.52619 114.25389 2.68285 0.01993 57.58835 555.46404
Price -24.97509 10.83213 -2.30565 0.03979 -48.57626 -1.37392
Advertising 74.13096 25.96732 2.85478 0.01449 17.55303 130.70888
.44172r2adj
44.2% of the variation in pie sales is explained by the variation in price and advertising, taking into account the sample size and number of independent variables
Adjusted r2 in ExcelDCOVA
Chap 14-15Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-15
Is the Model Significant?
F Test for Overall Significance of the Model Shows if there is a linear relationship between all
of the X variables considered together and Y Use F-test statistic Hypotheses:
H0: β1 = β2 = … = βk = 0 (no linear relationship)
H1: at least one βi ≠ 0 (at least one independent variable affects Y)
DCOVA
Chap 14-16Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-16
F Test for Overall Significance
Test statistic:
where FSTAT has numerator d.f. = k and
denominator d.f. = (n – k - 1)
1
kn
SSEk
SSR
MSE
MSRFSTAT
DCOVA
Chap 14-17Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-17
Regression Statistics
Multiple R 0.72213
R Square 0.52148
Adjusted R Square 0.44172
Standard Error 47.46341
Observations 15
ANOVA df SS MS F Significance F
Regression 2 29460.027 14730.013 6.53861 0.01201
Residual 12 27033.306 2252.776
Total 14 56493.333
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 306.52619 114.25389 2.68285 0.01993 57.58835 555.46404
Price -24.97509 10.83213 -2.30565 0.03979 -48.57626 -1.37392
Advertising 74.13096 25.96732 2.85478 0.01449 17.55303 130.70888
(continued)
F Test for Overall Significance In Excel
With 2 and 12 degrees of freedom
P-value for the F Test
6.53862252.8
14730.0
MSE
MSRFSTAT
DCOVA
Chap 14-18Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-18
H0: β1 = β2 = 0
H1: β1 and β2 not both zero
= .05
df1= 2 df2 = 12
Test Statistic:
Decision:
Conclusion:
Since FSTAT test statistic is in the rejection region (p-value < .05), reject H0
There is evidence that at least one independent variable affects Y
0
= .05
F0.05 = 3.885Reject H0Do not
reject H0
6.5386FSTAT MSE
MSR
Critical Value:
F0.05 = 3.885
F Test for Overall Significance(continued)
F
DCOVA
Chap 14-19Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-19
Two variable model
Y
X1
X2
22110 XbXbbY Yi
Yi
<
x2i
x1i
The best fit equation is found by minimizing the sum of squared errors, e2
Sample observation
Residuals in Multiple Regression
Residual =
ei = (Yi – Yi)
<
DCOVA
Chap 14-20Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-20
Multiple Regression Assumptions
Assumptions: The errors are normally distributed Errors have a constant variance The model errors are independent
ei = (Yi – Yi)
<
Errors (residuals) from the regression model:
DCOVA
Chap 14-21Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-21
Residual Plots Used in Multiple Regression
These residual plots are used in multiple regression:
Residuals vs. Yi
Residuals vs. X1i
Residuals vs. X2i
Residuals vs. time (if time series data)
<Use the residual plots to check for violations of regression assumptions
DCOVA
Chap 14-22Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-22
Are Individual Variables Significant?
Use t tests of individual variable slopes Shows if there is a linear relationship between
the variable Xj and Y holding constant the effects of other X variables
Hypotheses:
H0: βj = 0 (no linear relationship)
H1: βj ≠ 0 (linear relationship does exist between Xj and Y)
DCOVA
Chap 14-23Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-23
Are Individual Variables Significant?
H0: βj = 0 (no linear relationship)
H1: βj ≠ 0 (linear relationship does exist between Xj and Y)
Test Statistic:
(df = n – k – 1)
jb
jSTAT S
bt
0
(continued)
DCOVA
Chap 14-24Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-24
Regression Statistics
Multiple R 0.72213
R Square 0.52148
Adjusted R Square 0.44172
Standard Error 47.46341
Observations 15
ANOVA df SS MS F Significance F
Regression 2 29460.027 14730.013 6.53861 0.01201
Residual 12 27033.306 2252.776
Total 14 56493.333
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 306.52619 114.25389 2.68285 0.01993 57.58835 555.46404
Price -24.97509 10.83213 -2.30565 0.03979 -48.57626 -1.37392
Advertising 74.13096 25.96732 2.85478 0.01449 17.55303 130.70888
t Stat for Price is tSTAT = -2.306, with p-value .0398
t Stat for Advertising is tSTAT = 2.855, with p-value .0145
(continued)
Are Individual Variables Significant? Excel Output
DCOVA
Chap 14-25Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-25
d.f. = 15-2-1 = 12
a = .05
t/2 = 2.1788
Inferences about the Slope: t Test Example
H0: βj = 0
H1: βj 0
The test statistic for each variable falls in the rejection region (p-values < .05)
There is evidence that both Price and Advertising affect pie sales at = .05
From the Excel output:
Reject H0 for each variableDecision:
Conclusion:
Reject H0Reject H0
a/2=.025
-tα/2
Do not reject H0
0 tα/2
a/2=.025
-2.1788 2.1788
For Price tSTAT = -2.306, with p-value .0398
For Advertising tSTAT = 2.855, with p-value .0145
DCOVA
Chap 14-26Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-26
Confidence Interval Estimate for the Slope
Confidence interval for the population slope βj
Example: Form a 95% confidence interval for the effect of changes in price (X1) on pie sales:
-24.975 ± (2.1788)(10.832)
So the interval is (-48.576 , -1.374)
(This interval does not contain zero, so price has a significant effect on sales)
jbj Stb 2/α
Coefficients Standard Error
Intercept 306.52619 114.25389
Price -24.97509 10.83213
Advertising 74.13096 25.96732
where t has (n – k – 1) d.f.
Here, t has
(15 – 2 – 1) = 12 d.f.
DCOVA
Chap 14-27Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-27
Confidence Interval Estimate for the Slope
Confidence interval for the population slope βj
Example: Excel output also reports these interval endpoints:
Weekly sales are estimated to be reduced by between 1.37 to 48.58 pies for each increase of $1 in the selling price, holding the effect of price constant
Coefficients Standard Error … Lower 95% Upper 95%
Intercept 306.52619 114.25389 … 57.58835 555.46404
Price -24.97509 10.83213 … -48.57626 -1.37392
Advertising 74.13096 25.96732 … 17.55303 130.70888
(continued)
DCOVA
Chap 14-28Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-28
Using Dummy Variables
A dummy variable is a categorical independent variable with two levels: yes or no, on or off, male or female coded as 0 or 1
Assumes the slopes associated with numerical independent variables do not change with the value for the categorical variable
If more than two levels, the number of dummy variables needed is (number of levels - 1)
DCOVA
Chap 14-29Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-29
Dummy-Variable Example (with 2 Levels)
Let:
Y = pie sales
X1 = price
X2 = holiday (X2 = 1 if a holiday occurred during the week)
(X2 = 0 if there was no holiday that week)
210 XbXbbY21
DCOVA
Chap 14-30Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-30
Same slope
Dummy-Variable Example (with 2 Levels) (continued)
X1 (Price)
Y (sales)
b0 + b2
b0
1010
12010
Xb b (0)bXbbY
Xb)b(b(1)bXbbY
121
121
Holiday
No Holiday
Different intercept
Holiday (X2 = 1)No Holiday (X
2 = 0)
If H0: β2 = 0 is rejected, then“Holiday” has a significant effect on pie sales
DCOVA
Chap 14-31Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-31
Sales: number of pies sold per weekPrice: pie price in $
Holiday:
Interpreting the Dummy Variable Coefficient (with 2 Levels)
Example:
1 If a holiday occurred during the week0 If no holiday occurred
b2 = 15: on average, sales were 15 pies greater in weeks with a holiday than in weeks without a holiday, given the same price
)15(Holiday 30(Price) - 300 Sales
DCOVA
Chap 14-32Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-32
Dummy-Variable Models (more than 2 Levels)
The number of dummy variables is one less than the number of levels
Example:
Y = house price ; X1 = square feet
If style of the house is also thought to matter:
Style = ranch, split level, colonial
Three levels, so two dummy variables are needed
DCOVA
Chap 14-33Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-33
Dummy-Variable Models (more than 2 Levels)
Example: Let “colonial” be the default category, and let X2 and X3 be used for the other two categories:
Y = house price
X1 = square feet
X2 = 1 if ranch, 0 otherwise
X3 = 1 if split level, 0 otherwise
The multiple regression equation is:
3322110 XbXbXbbY
(continued)
DCOVA
Chap 14-34Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-34
18.840.045X20.43Y 1
23.530.045X20.43Y 1
Interpreting the Dummy Variable Coefficients (with 3 Levels)
With the same square feet, a ranch will have an estimated average price of 23.53 thousand dollars more than a colonial.
With the same square feet, a split-level will have an estimated average price of 18.84 thousand dollars more than a colonial.
Consider the regression equation:
321 18.84X23.53X0.045X20.43Y
10.045X20.43Y For a colonial: X2 = X3 = 0
For a ranch: X2 = 1; X3 = 0
For a split level: X2 = 0; X3 = 1
DCOVA
Chap 14-35Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-35
Interaction Between Independent Variables
Hypothesizes interaction between pairs of X variables Response to one X variable may vary at different
levels of another X variable
Contains two-way cross product terms
)X(XbXbXbb
XbXbXbbY
21322110
3322110
DCOVA
Chap 14-36Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-36
Effect of Interaction
Given:
Without interaction term, effect of X1 on Y is
measured by β1
With interaction term, effect of X1 on Y is measured by β1 + β3 X2
Effect changes as X2 changes
εXXβXβXββY 21322110
DCOVA
Chap 14-37Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-37
X2 = 1:Y = 1 + 2X1 + 3(1) + 4X1(1) = 4 + 6X1
X2 = 0: Y = 1 + 2X1 + 3(0) + 4X1(0) = 1 + 2X1
Interaction Example
Slopes are different if the effect of X1 on Y depends on X2 value
X1
4
8
12
0
0 10.5 1.5
Y = 1 + 2X1 + 3X2 + 4X1X2
Suppose X2 is a dummy variable and the estimated regression equation is Y
DCOVA
Chap 14-38Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-38
Logistic Regression
Used when the dependent variable Y is binary (i.e., Y takes on only two values)
Examples Customer prefers Brand A or Brand B Employee chooses to work full-time or part-time Loan is delinquent or is not delinquent Person voted in last election or did not
Logistic regression allows you to predict the probability of a particular categorical response
DCOVA
Chap 14-39Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-39
Logistic Regression
ikik2i21i10εXβXβXββratio) ln(odds
Where k = number of independent variables in the model
εi = random error in observation i
kik2i21i10XbXbXbbratio) odds edln(estimat
Logistic Regression Model:
Logistic Regression Equation:
(continued)
DCOVA
Chap 14-40Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 14-40
Estimated Odds Ratio and Probability of Success
Once you have the logistic regression equation, compute the estimated odds ratio:
The estimated probability of success is
ratio) odds edln(estimateratio odds Estimated
ratio odds estimated1
ratio odds estimatedsuccess ofy probabilit Estimated
DCOVA
Chap 15-41Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-41
The relationship between the dependent variable and an independent variable may not be linear
Can review the scatter plot to check for non-linear relationships
Example: Quadratic model
The second independent variable is the square of the first variable
Nonlinear Relationships
i21i21i10i εXβXββY
DCOVA
Chap 15-42Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-42
Quadratic Regression Model
where:
β0 = Y intercept
β1 = regression coefficient for linear effect of X on Y
β2 = regression coefficient for quadratic effect on Y
εi = random error in Y for observation i
i21i21i10i εXβXββY
Model form:DCOVA
Chap 15-43Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-43
Linear fit does not give random residuals
Linear vs. Nonlinear Fit
Nonlinear fit gives random residuals
X
resi
dua
ls
X
Y
X
resi
dua
ls
Y
X
DCOVA
Chap 15-44Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-44
Quadratic Regression Model
Quadratic models may be considered when the scatter plot takes on one of the following shapes:
X1
Y
X1X1
YYY
β1 < 0 β1 > 0 β1 < 0 β1 > 0
β1 = the coefficient of the linear term
β2 = the coefficient of the squared term
X1
i21i21i10i εXβXββY
β2 > 0 β2 > 0 β2 < 0 β2 < 0
DCOVA
Chap 15-45Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-45
Testing for Significance: Quadratic Effect
Testing the Quadratic Effect
Compare adjusted r2 from simple regression model to
adjusted r2 from the quadratic model
If adjusted r2 from the quadratic model is larger than the adjusted r2 from the simple model, then the quadratic model is likely a better model
(continued)
DCOVA
Chap 15-46Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-46
Example: Quadratic Model
Purity increases as filter time increases:PurityFilterTime
3 1
7 2
8 3
15 5
22 7
33 8
40 10
54 12
67 13
70 14
78 15
85 15
87 16
99 17
Purity vs. Time
0
20
40
60
80
100
0 5 10 15 20
Time
Pu
rity
DCOVA
Chap 15-47Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-47
Example: Quadratic Model(continued)
Regression Statistics
R Square 0.96888
Adjusted R Square 0.96628
Standard Error 6.15997
Simple regression results:
Y = -11.283 + 5.985 Time
CoefficientsStandard
Error t Stat P-value
Intercept -11.28267 3.46805 -3.25332 0.00691
Time 5.98520 0.30966 19.32819 2.078E-10
FSignificance
F
373.57904 2.0778E-10
^
Time Residual Plot
-10
-5
0
5
10
0 5 10 15 20
Time
Resid
uals
t statistic, F statistic, and r2 are all high, but the residuals are not random:
DCOVA
Chap 15-48Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-48
CoefficientsStandard
Error t Stat P-value
Intercept 1.53870 2.24465 0.68550 0.50722
Time 1.56496 0.60179 2.60052 0.02467
Time-squared 0.24516 0.03258 7.52406 1.165E-05
Quadratic regression results:
Y = 1.539 + 1.565 Time + 0.245 (Time)2^
Example: Quadratic Model(continued)
The quadratic term is statistically significant (p-value very small)
DCOVA
Chap 15-49Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-49
Regression Statistics
R Square 0.99494
Adjusted R Square 0.99402
Standard Error 2.59513
Quadratic regression results:
Y = 1.539 + 1.565 Time + 0.245 (Time)2^
Example: Quadratic Model(continued)
The adjusted r2 of the quadratic model is higher than the adjusted r2 of the simple regression model. The quadratic model explains 99.4% of the variation in Y.
DCOVA
Chap 15-50Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall
Example: Quadratic Model Residual Plots
Quadratic regression results:Y = 1.539 + 1.565 Time + 0.245 (Time)2
The residuals plotted versus both Time and Time-squared show a random pattern.
Time Residual Plot
-5
0
5
10
0 5 10 15 20
Time
Res
idua
ls
Time-squared Residual Plot
-5
0
5
10
0 100 200 300 400
Time-squared
Res
idua
ls
(continued)
DCOVA
Chap 15-51Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-51
Using Transformations in Regression Analysis
Idea: non-linear models can often be transformed
to a linear form Can be estimated by least squares if transformed
transform X or Y or both to get a better fit or to deal with violations of regression assumptions
Can be based on theory, logic or scatter plots
DCOVA
Chap 15-52Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-52
The Square Root Transformation
The square-root transformation
Used to overcome violations of the constant variance
assumption fit a non-linear relationship
i1i10i εXββY
DCOVA
Chap 15-53Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-53
Shape of original relationship
X
The Square Root Transformation(continued)
b1 > 0
b1 < 0
X
Y
Y
Y
Y
X
X
Relationship when transformed
i1i10i εXββY i1i10i εXββY DCOVA
Chap 15-54Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-54
Original multiplicative model
The Log Transformation
Transformed multiplicative model
iβ1i0i εXβY 1 i1i10i ε logX log ββ log Ylog
The Multiplicative Model:
Original multiplicative model Transformed exponential model
i2i21i10i ε ln XβXββ Yln
The Exponential Model:
iXβXββ
i εeY 2i21i10
DCOVA
Chap 15-55Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-55
Interpretation of Coefficients
For the multiplicative model:
When both dependent and independent variables are lagged: The coefficient of the independent variable Xk can
be interpreted as : a 1 percent change in Xk leads to an estimated bk percentage change in the average value of Y. Therefore bk is the elasticity of Y with respect to a change in Xk .
i1i10i ε logX log ββ log Ylog
DCOVA
Chap 15-56Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-56
Collinearity
Collinearity: High correlation exists among two or more independent variables
This means the correlated variables contribute redundant information to the multiple regression model
DCOVA
Chap 15-57Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-57
Collinearity
Including two highly correlated independent variables can adversely affect the regression results
No new information provided
Can lead to unstable coefficients (large standard error and low t-values)
Coefficient signs may not match prior expectations
(continued)
DCOVA
Chap 15-58Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-58
Some Indications of Strong Collinearity
Incorrect signs on the coefficients Large change in the value of a previous
coefficient when a new variable is added to the model
A previously significant variable becomes non-significant when a new independent variable is added
The estimate of the standard deviation of the model increases when a variable is added to the model
DCOVA
Chap 15-59Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-59
Detecting Collinearity (Variance Inflationary Factor)
VIFj is used to measure collinearity:
If VIFj > 5, Xj is highly correlated with the other independent variables
where R2j is the coefficient of determination of
variable Xj with all other X variables
2j
j R1
1VIF
DCOVA
Chap 15-60Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-60
Example: Pie Sales
Sales = b0 + b1 (Price)
+ b2 (Advertising)
WeekPie
SalesPrice
($)Advertising
($100s)
1 350 5.50 3.3
2 460 7.50 3.3
3 350 8.00 3.0
4 430 8.00 4.5
5 350 6.80 3.0
6 380 7.50 4.0
7 430 4.50 3.0
8 470 6.40 3.7
9 450 7.00 3.5
10 490 5.00 4.0
11 340 7.20 3.5
12 300 7.90 3.2
13 440 5.90 4.0
14 450 5.00 3.5
15 300 7.00 2.7
Recall the multiple regression equation of chapter 14:
DCOVA
Chap 15-61Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-61
Detecting Collinearity in Excel using PHStat
Output for the pie sales example: Since there are only two
independent variables, only one VIF is reported
VIF is < 5 There is no evidence of
collinearity between Price and Advertising
Regression Analysis
Price and all other X
Regression Statistics
Multiple R 0.030438
R Square 0.000926
Adjusted R Square -0.075925
Standard Error 1.21527
Observations 15
VIF 1.000927
PHStat / regression / multiple regression …
Check the “variance inflationary factor (VIF)” box
DCOVA
Chap 15-62Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-62
Model Building
Goal is to develop a model with the best set of independent variables Easier to interpret if unimportant variables are
removed Lower probability of collinearity
Stepwise regression procedure Provide evaluation of alternative models as variables
are added and deleted Best-subset approach
Try all combinations and select the best using the highest adjusted r2 and lowest standard error
DCOVA
Chap 15-63Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-63
Idea: develop the least squares regression equation in steps, adding one independent variable at a time and evaluating whether existing variables should remain or be removed
The coefficient of partial determination is the measure of the marginal contribution of each independent variable, given that other independent variables are in the model
Stepwise RegressionDCOVA
Chap 15-64Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-64
Best Subsets Regression
Idea: estimate all possible regression equations using all possible combinations of independent variables
Choose the best fit by looking for the highest adjusted r2 and lowest standard error
Stepwise regression and best subsets regression can be performed using PHStat
DCOVA
Chap 15-65Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-65
Alternative Best Subsets Criterion
Calculate the value Cp for each potential regression model
Consider models with Cp values close to or below k + 1
k is the number of independent variables in the model under consideration
DCOVA
Chap 15-66Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-66
Alternative Best Subsets Criterion
The Cp Statistic
))1k(2n(R1
)Tn)(R1(C
2T
2k
p
Where k = number of independent variables included in a
particular regression model
T = total number of parameters to be estimated in the
full regression model
= coefficient of multiple determination for model with k
independent variables
= coefficient of multiple determination for full model with
all T estimated parameters
2kR
2TR
(continued)
DCOVA
Chap 15-67Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-67
Steps in Model Building
1. Compile a listing of all independent variables under consideration
2. Estimate full model and check VIFs
3. Check if any VIFs > 5 If no VIF > 5, go to step 4 If one VIF > 5, remove this variable If more than one, eliminate the variable with the
highest VIF and go back to step 2
4.Perform best subsets regression with remaining variables
DCOVA
Chap 15-68Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-68
Steps in Model Building
5. List all models with Cp close to or less than (k + 1)
6. Choose the best model Consider parsimony Do extra variables make a significant contribution?
7.Perform complete analysis with chosen model, including residual analysis
8.Transform the model if necessary to deal with violations of linearity or other model assumptions
9.Use the model for prediction and inference
(continued)
DCOVA
Chap 15-69Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 15-69
Model Building Flowchart
Choose X1,X2,…Xk
Run regression to find VIFs
Remove variable with
highest VIF
Any VIF>5?
Run subsets regression to obtain
“best” models in terms of Cp
Do complete analysis
Add quadratic and/or interaction terms or transform variables
Perform predictions
No
More than one?
Remove this X
Yes
No
Yes
DCOVA