Pertemuan 3 Anova

Embed Size (px)

Citation preview

  • 7/30/2019 Pertemuan 3 Anova

    1/60

    ANOVA

    Chap 11-1

  • 7/30/2019 Pertemuan 3 Anova

    2/60

    -2

    Goals

    After completing this chapter, you should be able

    to:

    Recognize situations in which to use analysis of variance

    Understand different analysis of variance designs

    Perform a single-factor hypothesis test and interpret results

    Conduct and interpret post-analysis of variance pairwise

    comparisons procedures

    Set up and perform randomized blocks analysis

    Analyze two-factor analysis of variance test with replications

    results

  • 7/30/2019 Pertemuan 3 Anova

    3/60

    -3

    Chapter Overview

    Analysis of Variance (ANOVA)

    F-test

    F-testTukey-

    Kramer

    testFishers Least

    Significant

    Difference test

    One-WayANOVA RandomizedComplete

    Block ANOVA

    Two-factorANOVA

    with replication

  • 7/30/2019 Pertemuan 3 Anova

    4/60

    Chap 11-4

    General ANOVA Setting

    Investigator controls one or more independent

    variables

    Called factors (or treatment variables)

    Each factor contains two or more levels (orcategories/classifications)

    Observe effects on dependent variable

    Response to levels of independent variable

    Experimental design: the plan used to test

    hypothesis

  • 7/30/2019 Pertemuan 3 Anova

    5/60

    Chap 11-5

    One-Way Analysis of Variance

    Evaluate the difference among the means of three

    or more populations

    Examples: Accident rates for 1

    st

    , 2

    nd

    , and 3

    rd

    shift

    Assumptions

    Populations are normally distributed

    Populations have equal variances

    Samples are randomly and independently drawn

  • 7/30/2019 Pertemuan 3 Anova

    6/60

    Chap 11-6

    Completely Randomized Design

    Experimental units (subjects) are assigned

    randomly to treatments

    Only one factor or independent variable With two or more treatment levels

    Analyzed by

    One-factor analysis of variance (one-way ANOVA)

    Called a Balanced Design if all factor levels

    have equal sample size

  • 7/30/2019 Pertemuan 3 Anova

    7/60

    Chap 11-7

    Hypotheses of One-Way ANOVA

    All population means are equal

    i.e., no treatment effect (no variation in means among

    groups)

    At least one population mean is different

    i.e., there is a treatment effect

    Does not mean that all population means are different

    (some pairs may be the same)

    k3210 :H

    samethearemeanspopulationtheofallNot:HA

  • 7/30/2019 Pertemuan 3 Anova

    8/60

    Chap 11-8

    One-Factor ANOVA

    All Means are the same:

    The Null Hypothesis is True

    (No Treatment Effect)

    k3210 :H

    sametheareallNot:H iA

    321

  • 7/30/2019 Pertemuan 3 Anova

    9/60

    Chap 11-9

    One-Factor ANOVA

    At least one mean is different:

    The Null Hypothesis is NOT true

    (Treatment Effect is present)

    k3210 :H

    sametheareallNot:H iA

    321 321

    or

    (continued)

  • 7/30/2019 Pertemuan 3 Anova

    10/60

    Chap 11-10

    Partitioning the Variation

    Total variation can be split into two parts:

    SST = Total Sum of Squares

    SSB = Sum of Squares Between

    SSW = Sum of Squares Within

    SST = SSB + SSW

  • 7/30/2019 Pertemuan 3 Anova

    11/60

    Chap 11-11

    Partitioning the Variation

    Total Variation = the aggregate dispersion of the individualdata values across the various factor levels (SST)

    Within-Sample Variation = dispersion that exists among

    the data values within a particular factor level (SSW)

    Between-Sample Variation = dispersion among the factor

    sample means (SSB)

    SST = SSB + SSW

    (continued)

  • 7/30/2019 Pertemuan 3 Anova

    12/60

    Chap 11-12

    Partition of Total Variation

    Variation Due toFactor (SSB)

    Variation Due to RandomSampling (SSW)

    Total Variation (SST)

    Commonly referred to as:

    Sum of Squares Within

    Sum of Squares Error

    Sum of Squares Unexplained

    Within Groups Variation

    Commonly referred to as:

    Sum of Squares Between

    Sum of Squares Among

    Sum of Squares Explained

    Among Groups Variation

    = +

  • 7/30/2019 Pertemuan 3 Anova

    13/60

    Chap 11-13

    Total Sum of Squares

    k

    i

    n

    j ij

    i

    )xx(SST1 1

    2

    Where:

    SST = Total sum of squares

    k = number of populations (levels or treatments)

    ni = sample size from population i

    xij = jth measurement from population i

    x = grand mean (mean of all data values)

    SST = SSB + SSW

  • 7/30/2019 Pertemuan 3 Anova

    14/60

    Chap 11-14

    Total Variation(continued)

    Group 1 Group 2 Group 3

    Response, X

    X

    22

    12

    2

    11)xx(...)xx()xx(SST

    kkn

  • 7/30/2019 Pertemuan 3 Anova

    15/60

    Chap 11-15

    Sum of Squares Between

    Where:

    SSB = Sum of squares between

    k = number of populations

    ni = sample size from population i

    xi = sample mean from population i

    x = grand mean (mean of all data values)

    2

    1

    )xx(nSSB i

    k

    i

    i

    SST = SSB + SSW

  • 7/30/2019 Pertemuan 3 Anova

    16/60

    Chap 11-16

    Between-Group Variation

    Variation Due to

    Differences Among Groups

    i j

    2

    1

    )xx(nSSB i

    k

    i

    i

    1kSSBMSB

    Mean Square Between =

    SSB/degrees of freedom

  • 7/30/2019 Pertemuan 3 Anova

    17/60

    Chap 11-17

    Between-Group Variation(continued)

    Group 1 Group 2 Group 3

    Response, X

    X1

    X 2X

    3X

    22

    22

    2

    11)xx(n...)xx(n)xx(nSSB kk

  • 7/30/2019 Pertemuan 3 Anova

    18/60

    Chap 11-18

    Sum of Squares Within

    Where:

    SSW = Sum of squares within

    k = number of populationsni = sample size from population i

    xi = sample mean from population i

    xij

    = jth measurement from population i

    2

    11

    )xx(SSW iij

    n

    j

    k

    i

    j

    SST = SSB + SSW

  • 7/30/2019 Pertemuan 3 Anova

    19/60

    Chap 11-19

    Within-Group Variation

    Summing the variation

    within each group and then

    adding over all groups

    i

    kNSSWMSW

    Mean Square Within =

    SSW/degrees of freedom

    2

    11

    )xx(SSW iij

    n

    j

    k

    i

    j

  • 7/30/2019 Pertemuan 3 Anova

    20/60

    Chap 11-20

    Within-Group Variation(continued)

    Group 1 Group 2 Group 3

    Response, X

    1X

    2X

    3X

    22

    212

    2

    111)xx(...)xx()xx(SSW kknk

  • 7/30/2019 Pertemuan 3 Anova

    21/60

    Chap 11-21

    One-Way ANOVA Table

    Source of

    VariationdfSS MS

    Between

    Samples SSB MSB =

    Within

    SamplesN - kSSW MSW =

    Total N - 1SST =SSB+SSW

    k - 1MSB

    MSW

    F ratio

    k = number of populations

    N = sum of the sample sizes from all populations

    df = degrees of freedom

    SSB

    k - 1

    SSW

    N - k

    F =

  • 7/30/2019 Pertemuan 3 Anova

    22/60

    Chap 11-22

    One-Factor ANOVAF Test Statistic

    Test statistic

    MSB is mean squares between variances

    MSWis mean squares within variances

    Degrees of freedom

    df1 = k 1 (k = number of populations)

    df2 = N k (N = sum of sample sizes from all populations)

    MSWMSBF

    H0: 1= 2= = k

    HA: At least two population means are different

  • 7/30/2019 Pertemuan 3 Anova

    23/60

    Chap 11-23

    Interpreting One-Factor ANOVAF Statistic

    The F statistic is the ratio of the betweenestimate of variance and the within estimateof variance

    The ratio must always be positive df1 = k-1 will typically be small

    df2 = N- k will typically be large

    The ratio should be close to 1 ifH0: 1= 2= = k is true

    The ratio will be larger than 1 ifH0: 1= 2= = k is false

  • 7/30/2019 Pertemuan 3 Anova

    24/60

    Chap 11-24

    One-Factor ANOVAF Test Example

    You want to see if three

    different group of woman

    yield different distances in 10

    seconds. You randomlyselect five measurements

    from trials on a sprint. At the

    .05 significance level, is there

    a difference in meandistance?

    group-1group-2 group-3

    254 234 200

    263 218 222

    241 235 197237 227 206

    251 216 204

  • 7/30/2019 Pertemuan 3 Anova

    25/60

    Chap 11-25

    One-Factor ANOVA Example:Scatter Diagram

    270

    260

    250

    240

    230

    220

    210200

    190

    Distance

    1X

    2X

    3X

    X

    227.0x

    205.8x226.0x249.2x 321

    group-1group-2 group-3

    254 234 200

    263 218 222241 235 197

    237 227 206

    251 216 204

    group1 2 3

  • 7/30/2019 Pertemuan 3 Anova

    26/60

    Chap 11-26

    One-Factor ANOVA ExampleComputations

    group-1 group-2 group-3

    254 234 200

    263 218 222

    241 235 197

    237 227 206

    251 216 204

    x1 = 249.2

    x2 = 226.0

    x3 = 205.8

    x = 227.0

    n1 = 5

    n2 = 5

    n3 = 5

    N = 15

    k = 3

    SSB = 5 [ (249.2 227)2 + (226 227)2 + (205.8 227)2 ] = 4716.4

    SSW = (254 249.2)2 + (263 249.2)2++ (204 205.8)2 = 1119.6

    MSB = 4716.4 / (3-1) = 2358.2

    MSW = 1119.6 / (15-3) = 93.325.275

    93.3

    2358.2F

  • 7/30/2019 Pertemuan 3 Anova

    27/60

    Chap 11-27

    F= 25.275

    One-Factor ANOVA ExampleSolution

    H0: 1 = 2 = 3

    HA: i not all equal

    = .05

    df1= 2 df2 = 12

    Test Statistic:

    Decision:

    Conclusion:

    Reject H0 at = 0.05

    There is evidence that

    at least one i differs

    from the rest

    0 = .05

    F.05

    = 3.885

    Reject H0Do notreject H0

    25.275

    93.3

    2358.2

    MSW

    MSBF

    Critical

    Value:

    F

    = 3.885

  • 7/30/2019 Pertemuan 3 Anova

    28/60

    Chap 11-28

    SUMMARY

    Groups Count Sum Average Variance

    Club 1 5 1246 249.2 108.2

    Club 2 5 1130 226 77.5Club 3 5 1029 205.8 94.2

    ANOVA

    Source of

    VariationSS df MS F P-value F crit

    BetweenGroups

    4716.4 2 2358.2 25.275 4.99E-05 3.885

    Within

    Groups1119.6 12 93.3

    Total 5836.0 14

    ANOVA -- Single Factor:Excel Output

    EXCEL: tools | data analysis | ANOVA: single factor

  • 7/30/2019 Pertemuan 3 Anova

    29/60

    Chap 11-29

    The Tukey-Kramer Procedure

    Tells which population means are significantlydifferent e.g.: 1 = 23

    Done after rejection of equal means in ANOVA Allows pair-wise comparisons

    Compare absolute mean differences with criticalrange

    x1 = 2 3

  • 7/30/2019 Pertemuan 3 Anova

    30/60

    Chap 11-30

    Tukey-Kramer Critical Range

    where:

    q

    = Value from standardized range table

    with k and N - k degrees of freedom for

    the desired level of

    MSW = Mean Square Within

    ni and nj = Sample sizes from populations (levels) i and j

    ji n

    1

    n

    1

    2

    MSWqRangeCritical

  • 7/30/2019 Pertemuan 3 Anova

    31/60

    Chap 11-31

    The Tukey-Kramer Procedure:Example

    1. Compute absolute meandifferences:group-1 group-2 group-3

    254 234 200

    263 218 222

    241 235 197

    237 227 206

    251 216 204

    20.2205.8226.0xx

    43.4205.8249.2xx

    23.2226.0249.2xx

    32

    31

    21

    2. Find the q value from the table in appendix J with

    k and N - k degrees of freedom forthe desired level of

    3.77q

  • 7/30/2019 Pertemuan 3 Anova

    32/60

    Chap 11-32

    The Tukey-Kramer Procedure:Example

    5. All of the absolute mean differencesare greater than critical range.Therefore there is a significant

    difference between each pair ofmeans at 5% level of significance.

    16.2855

    1

    5

    1

    2

    93.33.77

    n

    1

    n

    1

    2

    MSWqRangeCritical

    ji

    3. Compute Critical Range:

    20.2xx

    43.4xx

    23.2xx

    32

    31

    21

    4. Compare:

  • 7/30/2019 Pertemuan 3 Anova

    33/60

    Chap 11-33

    Tukey-Kramer in PHStat

  • 7/30/2019 Pertemuan 3 Anova

    34/60

    Chap 11-34

    Randomized Complete Block ANOVA

    Like One-Way ANOVA, we test for equal populationmeans (for different factor levels, for example)...

    ...but we want to control for possible variation from asecond factor (with two or more levels)

    Used when more than one factor may influence thevalue of the dependent variable, but only one is of keyinterest

    Levels of the secondary factor are called blocks

  • 7/30/2019 Pertemuan 3 Anova

    35/60

    Chap 11-35

    Partitioning the Variation

    Total variation can now be split into three parts:

    SST = Total sum of squares

    SSB = Sum of squares between factor levels

    SSBL = Sum of squares between blocks

    SSW = Sum of squares within levels

    SST = SSB + SSBL + SSW

  • 7/30/2019 Pertemuan 3 Anova

    36/60

    Chap 11-36

    Sum of Squares for Blocking

    Where:

    k = number of levels for this factor

    b = number of blocks

    xj = sample mean from the jth block

    x = grand mean (mean of all data values)

    2

    1)xx(kSSBL j

    b

    j

    SST = SSB + SSBL + SSW

  • 7/30/2019 Pertemuan 3 Anova

    37/60

    Chap 11-37

    Partitioning the Variation

    Total variation can now be split into three parts:

    SST and SSB are

    computed as they werein One-Way ANOVA

    SST = SSB + SSBL + SSW

    SSW = SST (SSB + SSBL)

  • 7/30/2019 Pertemuan 3 Anova

    38/60

    Chap 11-38

    Mean Squares

    1k

    SSBbetweensquareMeanMSB

    1b

    SSBLblockingsquareMeanMSBL

    )b)(k(

    SSWwithinsquareMeanMSW

    11

  • 7/30/2019 Pertemuan 3 Anova

    39/60

    Chap 11-39

    Randomized Block ANOVA Table

    Source of

    VariationdfSS MS

    Between

    SamplesSSB MSB

    Within

    Samples (k1)(b-1)SSW MSW

    Total N - 1SST

    k - 1

    MSBL

    MSW

    F ratio

    k = number of populations N = sum of the sample sizes from all populations

    b = number of blocks df = degrees of freedom

    Between

    Blocks

    SSBL b - 1 MSBL

    MSB

    MSW

  • 7/30/2019 Pertemuan 3 Anova

    40/60

    Chap 11-40

    Blocking Test

    Blocking test: df1 = b - 1

    df2 = (k 1)(b 1)

    MSBL

    MSW

    ...:H b3b2b10

    equalaremeansblockallNot:HA

    F =

    Reject H0 if F > F

  • 7/30/2019 Pertemuan 3 Anova

    41/60

    Chap 11-41

    Main Factor test: df1 = k - 1

    df2 = (k 1)(b 1)

    MSB

    MSW

    k3210 ...:H

    equalaremeanspopulationallNot:HA

    F =

    Reject H0 if F > F

    Main Factor Test

  • 7/30/2019 Pertemuan 3 Anova

    42/60

    Chap 11-42

    FishersLeast Significant Difference Test

    To test which population means are significantlydifferent e.g.: 1 = 23 Done after rejection of equal means in randomized

    block ANOVA design

    Allows pair-wise comparisons Compare absolute mean differences with critical

    range

    x= 1 2 3

  • 7/30/2019 Pertemuan 3 Anova

    43/60

    Chap 11-43

    Fishers Least SignificantDifference (LSD) Test

    where:

    t/2 = Upper-tailed value from Students t-distribution

    for/2 and (k -1)(n - 1) degrees of freedom

    MSW = Mean square within from ANOVA table

    b = number of blocks

    k = number of levels of the main factor

    b

    2MSWtLSD /2

    h f

  • 7/30/2019 Pertemuan 3 Anova

    44/60

    Chap 11-44

    ...etc

    xx

    xx

    xx

    32

    31

    21

    Fishers Least SignificantDifference (LSD) Test

    (continued)

    b

    2MSWtLSD /2

    If the absolute mean differenceis greater than LSD then thereis a significant differencebetween that pair of means atthe chosen level of significance.

    Compare:?LSDxxIs ji

  • 7/30/2019 Pertemuan 3 Anova

    45/60

    RCBD Example

    Chap 11-45

    A physical therapist wished to compare three

    methods for teaching patiens to use a certain

    prosthetic device. He felt that there rate oflearning would be different for patients of

    different ages and wished to design and

    experiment in which the influence of age couldbe taken out

  • 7/30/2019 Pertemuan 3 Anova

    46/60

    Chap 11-46

    Data:

    Three patients in each of five age groups were

    selected to participate in the experiment, and onepatient in each age group was randomly assigned

    to each of teaching methods. The methods of

    instruction constitute our three treatments, and the

    five groups are the blocs. The data are shown on

    the table.

  • 7/30/2019 Pertemuan 3 Anova

    47/60

    Chap 11-47

  • 7/30/2019 Pertemuan 3 Anova

    48/60

    Chap 11-48

    Two-Way ANOVA

    Examines the effect of

    Two or more factors of interest on the

    dependent variable

    e.g.: Percent carbonation and line speed onsoft drink bottling process

    Interaction between the different levels of these

    two factors

    e.g.: Does the effect of one particularpercentage of carbonation depend on which

    level the line speed is set?

  • 7/30/2019 Pertemuan 3 Anova

    49/60

    Chap 11-49

    Two-Way ANOVA

    Assumptions

    Populations are normally distributed

    Populations have equal variances

    Independent random samples are

    drawn

    (continued)

    Two Way ANOVA

  • 7/30/2019 Pertemuan 3 Anova

    50/60

    Chap 11-50

    Two-Way ANOVASources of Variation

    Two Factors of interest: A and B

    a = number of levels of factor Ab = number of levels of factor B

    N = total number of observations in all cells

    T W ANOVA

  • 7/30/2019 Pertemuan 3 Anova

    51/60

    Chap 11-51

    Two-Way ANOVASources of Variation

    SST

    Total Variation

    SSAVariation due to factor A

    SSBVariation due to factor B

    SSAB

    Variation due to interactionbetween A and B

    SSEInherent variation (Error)

    Degrees of

    Freedom:

    a 1

    b 1

    (a 1)(b 1)

    N ab

    N - 1

    SST = SSA + SSB + SSAB + SSE

    (continued)

  • 7/30/2019 Pertemuan 3 Anova

    52/60

    Chap 11-52

    Two Factor ANOVA Equations

    a

    i

    b

    j

    n

    k

    ijk )xx(SST1 1 1

    2

    2

    1

    )xx(nbSSa

    i

    iA

    2

    1

    )xx(naSSb

    j

    jB

    Total Sum of Squares:

    Sum of Squares Factor A:

    Sum of Squares Factor B:

  • 7/30/2019 Pertemuan 3 Anova

    53/60

    Chap 11-53

    Two Factor ANOVA Equations

    2

    1 1

    )xxxx(nSSa

    i

    b

    j

    jiijAB

    a

    i

    b

    j

    n

    k

    ijijk )xx(SSE1 1 1

    2

    Sum of Squares

    Interaction Between

    A and B:

    Sum of Squares Error:

    (continued)

  • 7/30/2019 Pertemuan 3 Anova

    54/60

    Chap 11-54

    Two Factor ANOVA Equations

    where:MeanGrand

    nab

    x

    x

    a

    i

    b

    j

    n

    k

    ijk

    1 1 1

    AfactorofleveleachofMeannb

    x

    x

    b

    j

    n

    k

    ijk

    i

    1 1

    BfactorofleveleachofMeanna

    x

    x

    a

    i

    n

    k

    ijk

    j

    1 1

    celleachofMeann

    xx

    n

    k

    ijk

    ij

    1

    a = number of levels of factor A

    b = number of levels of factor B

    n = number of replications in each cell

    (continued)

  • 7/30/2019 Pertemuan 3 Anova

    55/60

    Chap 11-55

    Mean Square Calculations

    1a

    SSAfactorsquareMeanMS AA

    1 b

    SSBfactorsquareMeanMS BB

    )b)(a(

    SSninteractiosquareMeanMS ABAB

    11

    abN

    SSEerrorsquareMeanMSE

    Two-Way ANOVA:

  • 7/30/2019 Pertemuan 3 Anova

    56/60

    Chap 11-56

    Two-Way ANOVA:The F Test Statistic

    F Test for Factor B Main Effect

    F Test for Interaction Effect

    H0: A1 = A2 = A3=

    HA: Not all Ai are equal

    H0: factors A and B do not interactto affect the mean response

    HA: factors A and B do interact

    F Test for Factor A Main Effect

    H0: B1 = B2 = B3=

    HA: Not all Bi are equal

    Reject H0

    if F > FMSEMS

    F A

    MSE

    MSF B

    MSE

    MSF AB

    Reject H0

    if F > F

    Reject H0

    if F > F

    Two-Way ANOVA

  • 7/30/2019 Pertemuan 3 Anova

    57/60

    Chap 11-57

    Two-Way ANOVASummary Table

    Source of

    Variation

    Sum of

    Squares

    Degrees of

    Freedom

    Mean

    Squares

    F

    Statistic

    Factor A SSA a 1MSA

    = SSA /(a 1)

    MSA

    MSE

    Factor B SSB b 1MSB

    = SSB /(b 1)

    MSB

    MSE

    AB

    (Interaction)

    SSAB (a 1)(b 1)MSAB

    = SSAB / [(a 1)(b 1)]

    MSAB

    MSE

    Error SSE N abMSE =

    SSE/(N ab)

    Total SST N 1

    Features of Two Way ANOVA

  • 7/30/2019 Pertemuan 3 Anova

    58/60

    Chap 11-58

    Features of Two-Way ANOVAFTest

    Degrees of freedom always add up

    N-1 = (N-ab) + (a-1) + (b-1) + (a-1)(b-1)

    Total = error + factor A + factor B + interaction

    The denominator of the FTest is always the

    same but the numerator is different

    The sums of squares always add up

    SST = SSE + SSA + SSB + SSAB

    Total = error + factor A + factor B + interaction

    Examples:

  • 7/30/2019 Pertemuan 3 Anova

    59/60

    Chap 11-59

    Examples:Interaction vs. No Interaction

    No interaction:

    1 2

    Factor B Level 1

    Factor B Level 3

    Factor B Level 2

    Factor A Levels 1 2

    Factor B Level 1

    Factor B Level 3

    Factor B Level 2

    Factor A Levels

    MeanResponse

    Me

    anResponse

    Interaction is

    present:

  • 7/30/2019 Pertemuan 3 Anova

    60/60

    Chapter Summary

    Described one-way analysis of variance The logic of ANOVA

    ANOVA assumptions

    F test for difference in k means

    The Tukey-Kramer procedure for multiple comparisons

    Described randomized complete block designs

    F test

    Fishers least significant difference test for multiplecomparisons

    Described two-way analysis of variance

    Examined effects of multiple factors and interaction