Date post: | 13-Mar-2016 |
Category: |
Documents |
Upload: | florence-vaughn |
View: | 48 times |
Download: | 0 times |
1
Power Fifteen
Analysis of Variance (ANOVA)
2
Analysis of Variance
One-Way ANOVA• Tabular• Regression
Two-Way ANOVA• Tabular • Regression
3
One-Way ANOVA Apple Juice Concentrate Example, Data
File xm 15-01 New product Try 3 different advertising strategies, one in
each of three cities• City 1: convenience of use• City 2: quality of product• City 3: price
Record Weekly Sales
4
Advertising Strategies & Weekly Sales for 20 Weeks
Convenience Quality Price529 804 672658 630 531793 774 443
- - -614 624 532
Mean: 577.5 Mean: 653.0 Mean: 608.65
5
Figure 1: Mean Apple Juice Sales By Advertising Strategy
520540560580600620640660
convenience quality priceAdvertising Strategy
Is There a Significant Difference in Average Sales?
Null Hypothesis, H0 :
Alternative Hypothesis:323121 ,,
6
Table 3: 1-Way ANOVA of Apple Juice Sales By Advertising StrategySource of Variation Sum of Squares Degrees of
FreedomMeanSquare
Explained(betweentreatments)
ESS =
k
j 1nj ( x j - x )2 k-1 ESS/(k-1)
Unexplained(withintreatments)
USS =
k
j 1
)(
1
jn
i(xij - x j)2 n-k USS/(n-k)
Total TSS =
k
j 1
)(
1
jn
i(xij - x ) 2 n-1
Fk-1, n-k = [ESS/(k-1)]/[USS/(n-k)]
7
Apple Juice Concentrate ANOVASource ofVariation
Sum ofSquares
Degrees ofFreedom
MeanSquare
Explained(BetweenTreatments)
ESS=57,512.23
k-1 = 2 ESS/(k-1)=28,756.12
Unexplained(WithinTreatments)
USS=506,984
n-k = 57 USS/(n-k)=8894.45
Total TSS=564,496
n-1 = 59
F2, 57 = 28,756.12/8894.45 = 3.23
8
0.0
0.2
0.4
0.6
0.8
1.0
0 2 4 6 8 10
F Variable
DE
NS
ITY
F igure 2: F-Distribution Density For 2 DOF, 57 DOF
F-Distribution Test of the Null Hypothesis of No Difference in Mean Sales with Advertising Strategy
F2, 60 (critical) @ 5% =3.15
9
One-Way ANOVA and Regression
10
y(1)y(2)y(3)
1 0 00 1 00 0 1
Regression Set-Up: y(1) is column of 20 sales observationsFor city 1, 1 is a column of 20 ones, 0 is a column of 20 Zeros. Regression of a quantitative variable on three dummies
Y = C(1)*Dummy(city 1) + C(2)*Dummy(city 2) + C(3)*Dummy(city 3) + e
11
Table 5: One-Way ANOVA Estimated Using RegressionDependent Variable: SALESAJMethod: Least Squares
Sample: 1 60Included observations: 60
Variable Coefficient Std. Error t-Statistic Prob.
CONVENIENCE 577.5500 21.08844 27.38704 0.0000QUALITY 653.0000 21.08844 30.96483 0.0000
PRICE 608.6500 21.08844 28.86178 0.0000
R-squared 0.101882 Mean dependent var 613.0667Adjusted R-squared
0.070370 S.D. dependent var 97.81474
S.E. of regression 94.31038 Akaike info criterion 11.97977Sum squaredresid
506983.5 Schwarz criterion 12.08448
Log likelihood -356.3930 F-statistic 3.233041Durbin-Watsonstat
1.525930 Prob(F-statistic) 0.046773
One-Way ANOVA and Regression
Regression Coefficients are the City Means; F statistic
Dependent Variable: SALESAJMethod: Least Squares Sample: 1 60
Included observations: 60Variable Coefficient Std. Error t-Statistic Prob. CONVENIENCE 577.5500 21.08844 27.38704 0.0000QUALITY 653.0000 21.08844 30.96483 0.0000PRICE 608.6500 21.08844 28.86178 0.0000
R-squared 0.101882 Mean dependent var 613.0667 Adjusted R-squared 0.070370 S.D. dependent var 97.81474 S.E. of regression 94.31038 Akaike info criterion 11.97977 Sum squared resid 506983.5 Schwarz criterion 12.08448 Log likelihood-356.3930 Durbin-Watson stat 1.525930
Regression Coefficients are the City Means; F statistic (?)
14
15
Table 6: Test of the Null Hypothesis: All Treatment Means Are EqualWald Test:Equation: Untitled
NullHypothesis:
C(1)=C(3)
C(2)=C(3)
F-statistic 3.233041 Probability 0.046773Chi-square 6.466083 Probability 0.039437
16
Anova and Regression: One-WayInterpretation
Salesaj = c(1)*convenience+c(2)*quality+c(3)*price+ e
E[salesaj/(convenience=1, quality=0, price=0)] =c(1) = mean for city(1)• c(1) = mean for city(1) (convenience)• c(2) = mean for city(2) (quality)• c(3) = mean for city(3) (price)• Test the null hypothesis that the means are equal
using a Wald test: c(1) = c(2) = c(3)
Table 5: One-Way ANOVA Estimated Using RegressionDependent Variable: SALESAJMethod: Least Squares
Sample: 1 60Included observations: 60
Variable Coefficient Std. Error t-Statistic Prob.
CONVENIENCE 577.5500 21.08844 27.38704 0.0000QUALITY 653.0000 21.08844 30.96483 0.0000
PRICE 608.6500 21.08844 28.86178 0.0000
R-squared 0.101882 Mean dependent var 613.0667Adjusted R-squared
0.070370 S.D. dependent var 97.81474
S.E. of regression 94.31038 Akaike info criterion 11.97977Sum squaredresid
506983.5 Schwarz criterion 12.08448
Log likelihood -356.3930 F-statistic 3.233041Durbin-Watsonstat
1.525930 Prob(F-statistic) 0.046773
One-Way ANOVA and Regression
Regression Coefficients are the City Means; F statistic
18
Anova and Regression: One-WayAlternative Specification: Drop Price Salesaj = c(1) +
c(2)*convenience+c(3)*quality+e E[Salesaj/(convenience=0, quality=0)] = c(1)
= mean for city(3) (price, the omitted one) E[Salesaj/(convenience=1, quality=0)] = c(1)
+ c(2) = mean for city(1) (convenience)• so mean for city(1) = c(1) + c(2)• so mean for city(1) = mean for city(3) + c(2)• and so c(2) = mean for city(1) - mean for city(3)
19
20
21
Anova and Regression: One-WayAlternative Specification: Drop Price Salesaj = c(1) +
c(2)*convenience+c(3)*quality+e E[Salesaj/(convenience=0, quality=0)] = c(1)
= mean for city(3) (price, the omitted one) E[Salesaj/(convenience=1, quality=0)] = c(1)
+ c(2) = mean for city(1) (convenience)• so mean for city(1) = c(1) + c(2)• so mean for city(1) = mean for city(3) + c(2)• and so c(2) = mean for city(1) - mean for city(3)
22
Anova and Regression: One-WayAlternative Specification Salesaj = c(1) +
c(2)*convenience+c(3)*quality+e• Test that the mean for city(1) = mean for city(3)• Using the t-statistic for c(2)
0:..,: 310310 xxHeixxH
23
Anova and Regression: One-WayAlternative Specification, Drop Quality Salesaj = c(1) +
c(2)*convenience+c(3)*price+e E[Salesaj/(convenience=0, price=0)] = c(1) =
mean for city(2) (quality, the omitted one) E[Salesaj/(convenience=1, price=0)] = c(1) +
c(2) = mean for city(1) (convenience)• so mean for city(1) = c(1) + c(2)• and so mean for city(1) = mean for city(2) + c(2)• so c(2) = mean for city(1) - mean for city(2)
24
25
Anova and Regression: One-WayAlternative Specification, Drop Quality Salesaj = c(1) +
c(2)*convenience+c(3)*price+e• Test that the mean for city(1) = mean for city(2)• Using the t-statistic for c(2)
26
Two-Way ANOVA Apple Juice Concentrate Two Factors
• 3 advertising strategies• 2 advertising media: TV & Newspapers
6 cities• City 1: convenience on TV• City 2: convenience in Newspapers• City 3: quality on TV• Etc.
27
Table 7: Apple Juice Concentrate Sales in Six CitiesCity 1 City 2 City 3 City 4 City 5 City 6
491 464 677 689 575 803712 559 627 650 614 584558 759 590 704 706 525447 557 632 652 484 498479 528 683 576 478 812624 670 760 836 650 565546 534 690 628 583 708444 657 548 798 536 546582 557 579 497 579 616672 474 644 841 795 587
Advertising Strategies In Two Media: Weekly Sales
28
Mean Weekly Sales By Strategy and Medium
Table 9: Mean Weekly Sales, Apple Juice Concentrate, Six CitiesConvenience Quality Price
Television city1: 555.5 city3: 643 city5: 600Newspapers city2: 575.9 city4: 687.1 city 6: 624.4
29
Figure 3; Mean Apple Juice Sales by AdvertisingStrategy and Medium
Strategy
Aver
age
0100200300400500600700
convenience
quality price
television
newspapers
Average Weekly Sales By Strategy & Medium
400
450
500
550
600
650
700
750
conveniencequality
Ave
rage
Sal
es
NewspapersTelevision
price
31
Is There Any Difference In Mean Sales Among the Six Cities?Table 8: 1-Way ANOVA of Apple Juice Sales, Six CitiesSource of Variation Sum of Squares Degrees of Freedom Mean SquareExplained(betweentreatments)
ESS = 113,620 k-1 = 5 ESS/(k-1) =22,724
Unexplained(withintreatments)
USS = 501,137 n-k = 54 USS/(n-k) =9280
Total TSS = 614,757 n-1 = 59
F5, 54 = (22,724/9,280) = 2.45, critical value at 5% = 2.38
------------------------------------------------------------------------
32
Table 10: Schematic For 2-Way ANOVA of Apple Juice SalesSource of Variation Sum of Squares Degrees of
FreedomMean Square
Explained(betweentreatments)
ESS = ESS/(k-1)
Strategy ESS(Strategy) a-1 ESS(Strat.)/(a-1)Medium ESS(Medium) b-1 ESS(Med)/(b-1)
Interaction ESS(Interaction) (a-1)(b-1) ESS(I)/(a-1)(b-1)Unexplained(withintreatments)
USS n-ab USS/(n-k)
Total TSS n-1
Table of ANOVA for Two-Way
33
TSS =
a
i1
b
j1
r
k1(xijk - x)2
Formulas For Sums of Squares
a is the # of treatments for strategies =3
b is the # of treatments for media =2
r is the # of replicates or observations =10
x= {
a
i1
b
j1
r
k1xijk }/n
The Grand Mean:
34
ESS(Strategy) = r b
a
i1(xiS - x)2
Formulas For Sums of Squares (Cont.)
Where the mean for treatment i, strategy, is:
xiS = {
b
j1
r
k1xijk }/r b
35
Mean Weekly Sales By Strategy and Medium
Table 9: Mean Weekly Sales, Apple Juice Concentrate, Six CitiesConvenience Quality Price
Television city1: 555.5 city3: 643 city5: 600Newspapers city2: 575.9 city4: 687.1 city 6: 624.4
36
Formulas For Sums of Squares (Cont.)
ESS(Medium) = r a
b
j1(xjM - x)2
Where the mean for treatment j, medium, is:
xjM = {
a
i1
r
k1xijk }/r a
37
Formulas For Sums of Squares (Cont.)
ESS(Interaction) = r
a
i1
b
j1(xijSM - xiS - xjM + x)2
USS =
a
i1
b
j1
r
k1(xijk - ijx)2
Where is the mean for each cityijx
38
Table 11: 2-Way ANOVA of Apple Juice SalesSource of Variation Sum of Squares Degrees of
FreedomMean Square
Explained(betweentreatments)
ESS =
Strategy ESS(Strat) = 98838.6 (a-1) = 2 49419.3Medium ESS(Med) = 13172.0 (b-1) = 1 13172.0
Interaction ESS(I) = 1609.6 (a-1)(b-1) = 2 804.8Unexplained(withintreatments)
USS = 501136.7 (n-ab) = 60 – 6= 54
9280.3
Total TSS = 614756.98 (n-1) = 59
Table of Two-Way ANOVA for Apple Juice Sales
39
F-Distribution Tests
F2, 54 = 804.8/9280.3 = 0.09
Test for Interaction:
Test for Advertising Medium:
F1, 54 = 13172/9280.3 = 1.42, and the critical value at the 5% level is 4.02,
Test for Advertising Strategy:
F2, 54 = 49419.3/9280.3 = 5.32, with a critical value of 3.17 at the 5% level,
40
Two-Way ANOVA and Regression
41
Two-Way ANOVA and Regression
With Two-Way ANOVA you cannot include both 3 dummy variables for strategy and two dummy variables for media, without a constant, so a different specification is needed.
You need to drop one of the strategy variables and drop one of the media varibles and include the constant.
42
)3()2()1(
yyy
= 110001101
Regression Set-Up
)6()5()4(
yyy
000100010
Convenience dummyQuality dummy
TV dummy
111
111
constant
SALESAPJ CONVENIENCE QUALITY PRICETELEVISION NEWSPAPERS491 1 0 0 1 0712 1 0 0 1 0558 1 0 0 1 0447 1 0 0 1 0479 1 0 0 1 0624 1 0 0 1 0546 1 0 0 1 0444 1 0 0 1 0582 1 0 0 1 0672 1 0 0 1 0464 1 0 0 0 1559 1 0 0 0 1759 1 0 0 0 1557 1 0 0 0 1528 1 0 0 0 1670 1 0 0 0 1534 1 0 0 0 1657 1 0 0 0 1557 1 0 0 0 1474 1 0 0 0 1677 0 1 0 1 0627 0 1 0 1 0
44
ANOVA and Regression: Two-WaySeries of Regressions; Compare to Table 11, Lecture 15
Salesaj = c(1) + c(2)*convenience + c(3)* quality + c(4)*television + c(5)*convenience*television + c(6)*quality*television + e, SSR=501,136.7
Salesaj = c(1) + c(2)*convenience + c(3)* quality + c(4)*television + e, SSR=502,746.3
Test for interaction effect: F2, 54 = [(502746.3-501136.7)/2]/(501136.7/54) = (1609.6/2)/9280.3 = 0.09
Table 11: 2-Way ANOVA of Apple Juice SalesSource of Variation Sum of Squares Degrees of
FreedomMean Square
Explained(betweentreatments)
ESS =
Strategy ESS(Strat) = 98838.6 (a-1) = 2 49419.3Medium ESS(Med) = 13172.0 (b-1) = 1 13172.0
Interaction ESS(I) = 1609.6 (a-1)(b-1) = 2 804.8Unexplained(withintreatments)
USS = 501136.7 (n-ab) = 60 – 6= 54
9280.3
Total TSS = 614756.98 (n-1) = 59
Table of Two-Way ANOVA for Apple Juice Sales
Dependent Variable: SALESAPJMethod: Least Squares
Sample: 1 60Included observations: 60
Variable Coefficient Std. Error t-Statistic Prob.
CONVENIENCE -48.50000 43.08204 -1.125759 0.2652QUALITY 62.70000 43.08204 1.455363 0.1514TELEVISION -24.40000 43.08204 -0.566361 0.5735C 624.4000 30.46360 20.49659 0.0000CONVENIENCE*TELEVISION 4.000000 60.92720 0.0656520.9479QUALITY*TELEVISION -19.70000 60.92720 -0.323337 0.7477
R-squared 0.184821 Mean dependent var 614.3167Adjusted R-squared 0.109342 S.D. dependent var 102.0765S.E. of regression 96.33436 Akaike info criterion 12.06817Sum squared resid 501136.7 Schwarz criterion 12.27760Log likelihood -356.0450 F-statistic 2.448631Durbin-Watson stat 2.452725 Prob(F-statistic) 0.045165
Dependent Variable: SALESAPJMethod: Least SquaresSample: 1 60Included observations: 60Variable Coefficient Std. Error t-Statistic Prob. CONVENIENCE -46.50000 29.96267 -1.551931 0.1263QUALITY 52.85000 29.96267 1.763862 0.0832TELEVISION -29.63333 24.46441 -1.211283 0.2309C 627.0167 24.46441 25.62974 0.0000R-squared 0.182203 Mean dependent var 614.31Adjusted R-squared 0.138393 S.D. dependent var102.0765S.E. of regression 94.75027 Akaike info criterion12.00471Sum squared resid 502746.3 Schwarz criterion12.14433Log likelihood-356.1412 F-statistic 4.158888Durbin-Watson stat 2.456222 Prob(F-statistic)
0.009921
49
ANOVA By Difference Regression with interaction terms, USS =
501,136.7 Regression dropping interaction terms<
USS = 502746.3 Difference is 1,609.6 and is the sum of
squares explained by interaction terms F-test of the interaction terms:
F2, 54 = [1609.6/2]/[501,136.7/54]
50
ANOVA and Regression: Two-WaySeries of Regressions
Salesaj = c(1) + c(2)*convenience + c(3)* quality + e, SSR=515,918.3
Test for media effect: F1, 54 = [(515918.3-502746.3)/1]/(501136.7/54) = 13172/9280.3 = 1.42
Salesaj = c(1) +e, SSR = 614757 Test for strategy effect: F2, 54 = [(614757-
515918.3)/2]/(501136.7/54) = (98838.7/2)/(9280.3) = 5.32
Dependent Variable: SALESAPJMethod: Least Squares
Sample: 1 60Included observations: 60Variable Coefficient Std. Error t-Statistic Prob. CONVENIENCE -46.50000 30.08521 -1.545610 0.1277QUALITY 52.85000 30.08521 1.756677 0.0843C 612.2000 21.27346 28.77765 0.0000R-squared 0.160777 Mean dependent var 614.31Adjusted R-squared 0.131330 S.D. dependent var 102.07S.E. of regression 95.13779 Akaike info criterion11.99724Sum squared resid 515918.3 Schwarz criterion 12.101Log likelihood-356.9171 F-statistic 5.459975Durbin-Watson stat 2.379774 Prob(F-statistic)0.006769
52
Wald Test:Equation: UntitledNull Hypothesis: C(2)=C(3)F-statistic 138.2678 Probability 0.000000
Chi-square 138.2678 Probability 0.000000