36
20-1 ©2008 Raj Jain CSE567M Washington University in St. Louis One Factor One Factor Experiments Experiments Raj Jain Washington University in Saint Louis Saint Louis, MO 63130 [email protected] These slides are available on-line at: http://www.cse.wustl.edu/~jain/cse567-06/

One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

Embed Size (px)

Citation preview

Page 1: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-1©2008 Raj JainCSE567MWashington University in St. Louis

One Factor One Factor ExperimentsExperiments

Raj Jain Washington University in Saint Louis

Saint Louis, MO [email protected]

These slides are available on-line at:http://www.cse.wustl.edu/~jain/cse567-06/

Page 2: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-2©2008 Raj JainCSE567MWashington University in St. Louis

OverviewOverview

! Computation of Effects ! Estimating Experimental Errors! Allocation of Variation! ANOVA Table and F-Test! Visual Diagnostic Tests! Confidence Intervals For Effects! Unequal Sample Sizes

Page 3: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-3©2008 Raj JainCSE567MWashington University in St. Louis

One Factor ExperimentsOne Factor Experiments! Used to compare alternatives of a single categorical variable.

For example, several processors, several caching schemes

Page 4: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-4©2008 Raj JainCSE567MWashington University in St. Louis

Computation of Effects Computation of Effects

Page 5: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-5©2008 Raj JainCSE567MWashington University in St. Louis

Computation of Effects (Cont)Computation of Effects (Cont)

Page 6: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-6©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.1: Code Size ComparisonExample 20.1: Code Size Comparison

! Entries in a row are unrelated.(Otherwise, need a two factor analysis.)

Page 7: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-7©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.1 Code Size (Cont)Example 20.1 Code Size (Cont)

Page 8: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-8©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.1: InterpretationExample 20.1: Interpretation! Average processor requires 187.7 bytes of storage. ! The effects of the processors R, V, and Z are -13.3, -24.5, and

37.7, respectively. That is, " R requires 13.3 bytes less than an average processor" V requires 24.5 bytes less than an average processor, and " Z requires 37.7 bytes more than an average processor.

Page 9: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-9©2008 Raj JainCSE567MWashington University in St. Louis

Estimating Experimental ErrorsEstimating Experimental Errors! Estimated response for jth alternative:

! Error:

! Sum of squared errors (SSE):

Page 10: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-10©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.2Example 20.2

Page 11: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-11©2008 Raj JainCSE567MWashington University in St. Louis

Allocation of VariationAllocation of Variation

Page 12: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-12©2008 Raj JainCSE567MWashington University in St. Louis

Allocation of Variation (Cont)Allocation of Variation (Cont)

! Total variation of y (SST):

Page 13: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-13©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.3Example 20.3

Page 14: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-14©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.3 (Cont)Example 20.3 (Cont)

! 89.6% of variation in code size is due to experimental errors (programmer differences).Is 10.4% statistically significant?

Page 15: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-15©2008 Raj JainCSE567MWashington University in St. Louis

Analysis of Variance (ANOVA) Analysis of Variance (ANOVA) ! Importance ≠ Significance! Important ⇒ Explains a high percent of variation! Significance ⇒ High contribution to the variation compared to that by errors.

! Degree of freedom = Number of independent values required to compute

Note that the degrees of freedom also add up.

Page 16: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-16©2008 Raj JainCSE567MWashington University in St. Louis

FF--TestTest! Purpose: To check if SSA is significantly greater than SSE.

Errors are normally distributed ⇒ SSE and SSA have chi-square distributions.The ratio (SSA/νΑ)/(SSE/νe) has an F distribution.

where νA=a-1 = degrees of freedom for SSAνe=a(r-1) = degrees of freedom for SSE

Computed ratio > F[1- α; νA, νe]

⇒ SSA is significantly higher than SSE.SSA/νA is called mean square of A or (MSA).Similary, MSE=SSE/νe

Page 17: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-17©2008 Raj JainCSE567MWashington University in St. Louis

ANOVA Table for One Factor ExperimentsANOVA Table for One Factor Experiments

Page 18: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-18©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.4: Code Size ComparisonExample 20.4: Code Size Comparison

! Computed F-value < F from Table⇒ The variation in the code sizes is mostly due to experimental errors and not because of any significant difference among the processors.

Page 19: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-19©2008 Raj JainCSE567MWashington University in St. Louis

Visual Diagnostic TestsVisual Diagnostic TestsAssumptions: 1. Factors effects are additive.2. Errors are additive.3. Errors are independent of factor levels.4. Errors are normally distributed.5. Errors have the same variance for all factor levels.Tests:! Residuals versus predicted response:

No trend ⇒ IndependenceScale of errors << Scale of response⇒ Ignore visible trends.

! Normal quantilte-quantile plot linear ⇒ Normality

Page 20: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-20©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.5Example 20.5

! Horizontal and vertical scales similar⇒ Residuals are not small ⇒ Variation due to factors

is small compared to the unexplained variation! No visible trend in the spread! Q-Q plot is S-shaped ⇒ shorter tails than normal.

Page 21: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-21©2008 Raj JainCSE567MWashington University in St. Louis

Confidence Intervals For EffectsConfidence Intervals For Effects! Estimates are random variables

! For the confidence intervals, use t values at a(r-1) degrees of freedom.

! Mean responses: ! Contrasts ∑ hj αj: Use for α1-α2

Page 22: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-22©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6: Code Size ComparisonExample 20.6: Code Size Comparison

Page 23: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-23©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 (Cont)Example 20.6 (Cont)! For 90% confidence, t[0.95; 12]= 1.782.! 90% confidence intervals:

! The code size on an average processor is significantly different from zero.

! Processor effects are not significant.

Page 24: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-24©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 (Cont)Example 20.6 (Cont)! Using h1=1, h2=-1, h3=0, (∑ hj=0):

! CI includes zero ⇒ one isn't superior to other.

Page 25: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-25©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 (Cont)Example 20.6 (Cont)! Similarly,

! Any one processor is not superior to another.

Page 26: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-26©2008 Raj JainCSE567MWashington University in St. Louis

Unequal Sample SizesUnequal Sample Sizes

! By definition:

! Here, rj is the number of observations at jth level.N =total number of observations:

Page 27: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-27©2008 Raj JainCSE567MWashington University in St. Louis

Parameter EstimationParameter Estimation

Page 28: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-28©2008 Raj JainCSE567MWashington University in St. Louis

Analysis of VarianceAnalysis of Variance

Page 29: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-29©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.7: Code Size ComparisonExample 20.7: Code Size Comparison

! All means are obtained by dividing by the number of observations added.

! The column effects are 2.15, 13.75, and -21.92.

Page 30: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-30©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6: Analysis of VarianceExample 20.6: Analysis of Variance

Page 31: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-31©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 ANOVA (Cont)Example 20.6 ANOVA (Cont)! Sums of Squares:

! Degrees of Freedom:

Page 32: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-32©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 ANOVA TableExample 20.6 ANOVA Table

! Conclusion: Variation due processors is insignificant as compared to that due to modeling errors.

Page 33: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-33©2008 Raj JainCSE567MWashington University in St. Louis

Example 20.6 Standard Dev. of EffectsExample 20.6 Standard Dev. of Effects! Consider the effect of processor Z: Since,

! Error in α3 = ∑ Errors in terms on the right hand side:

! eij's are normally distributed ⇒ α3 is normal with

Page 34: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-34©2008 Raj JainCSE567MWashington University in St. Louis

SummarySummary

! Model for One factor experiments:

! Computation of effects! Allocation of variation, degrees of freedom! ANOVA table! Standard deviation of errors! Confidence intervals for effects and contracts! Model assumptions and visual tests

Page 35: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-35©2008 Raj JainCSE567MWashington University in St. Louis

Exercise 20.1Exercise 20.1For a single factor design, suppose we want to write an

expression for αj in terms of yij's:

What are the values of a..j's? From the above expression, the error in αj is seen to be:

Assuming errors eij are normally distributed with zero meanand variance σe

2, write an expression for variance of eαj.

Verify that your answer matches that in Table 20.5.

Page 36: One Factor Experiments - Washington University in St. …jain/cse567-08/ftp/k_20ofe.pdfOne Factor Experiments Raj Jain ... (ANOVA), F-Test, ANOVA Table for One Factor Experiments,

20-36©2008 Raj JainCSE567MWashington University in St. Louis

Homework 20Homework 20Analyze the following one factor experiment:

1. Compute the effects2. Prepare ANOVA table3. Compute confidence intervals for effects and interpret4. Compute Confidence interval for α1-α35. Show graphs for visual tests and interpret