Chapter 17 Two-way Anova

Embed Size (px)

Citation preview

  • 8/6/2019 Chapter 17 Two-way Anova

    1/43

    Chapter 17: Two-way ANOVA

    In the lecture on one-way ANOVA, we discussed the following experiment:

    Observe an emergency alone

    Observe an emergency w/ 1 other

    Observe an emergency w/ 2 others

    P + 2 people P + 1

    person

    P + 0 people

    X 2= 9 X 1= 8 X 0= 3

    In this experiment, we have ONE IV: the # of bystanders present

    What if we wanted to look at other IVs too?

    Chapter 17: Page 1

    IV = Number of people present

    DV = Time it takes (in secs.) to call for help

  • 8/6/2019 Chapter 17 Two-way Anova

    2/43

    EX: Would the amount of time people wait to help be affected by

    the gender of the person in need of help?

    Chapter 17: Page 2

  • 8/6/2019 Chapter 17 Two-way Anova

    3/43

    Lets do an experiment where we stage an emergency situation:

    IV1: The victim of the emergency is either male OR female

    IV2: The P witnesses the emergency alone, w/ 1 other, OR 2 others

    These two IVs are crossed, meaning that each level of one IV ispaired with all levels of the other IV

    Put another way, we have all possible combinations of the IVs

    P + 2 people P + 1

    person

    P + 0 people

    Male victim X = 9 X = 8 X = 3

    Female victim X = 4 X = 4 X = 2

    Chapter 17: Page 3

  • 8/6/2019 Chapter 17 Two-way Anova

    4/43

    Chapter 17: Page 4

  • 8/6/2019 Chapter 17 Two-way Anova

    5/43

    VOCABULARY

    Factor = Independent variable

    Two-factor ANOVA / Two-way ANOVA: an experiment with 2

    independent variables

    Levels: number of treatment conditions (groups) for a specific IVNOTATION

    3 X 2 factorial = experiment w/ 2 IVs: one w/ 3 levels, one w/ 2

    levels

    2 X 2 factorial = experiment w/ 2 IVs: both w/ 2 levels

    3 X 2 X 2 = ????

    Chapter 17: Page 5

  • 8/6/2019 Chapter 17 Two-way Anova

    6/43

    Why do a two-factor (two-way) ANOVA?

    1. Greatergeneralizability of results

    --EX: If experiment is only done with a male victim, we dont

    know if the results are also true for female victims

    2. Allows one to look forinteractions--The effect of one IV depends on the level of the other IV

    --EX: Sample of patients who have an infection:

    get antibiotics and are not allergic

    dont get antibiotics and are not allergic get antibiotics and are allergic

    dont get antibiotics and are allergic

    --Measure how well the patients feel the next day

    Chapter 17: Page 6

  • 8/6/2019 Chapter 17 Two-way Anova

    7/43

    3

    5

    3

    1

    0

    1

    2

    3

    4

    5

    6

    No Yes

    Receive Anti-biotic

    How

    doyoufeelrightnow?

    No

    Yes

    This illustrates an interaction

    Chapter 17: Page 7

    Allergic?

  • 8/6/2019 Chapter 17 Two-way Anova

    8/43

    3

    5

    3

    5

    0

    1

    2

    3

    4

    5

    6

    No Yes

    Receive anti-biotic

    How

    doyoufeelrightnow?

    No

    Yes

    If there were no interaction, then the graph would have looked

    like this

    Chapter 17: Page 8

    Allergic?

  • 8/6/2019 Chapter 17 Two-way Anova

    9/43

    Lets return to our bystander intervention experiment:

    P + 2 people P + 1

    person

    P + 0 people

    Male victim X = 9 X = 8 X = 3

    Female victim X = 4 X = 4 X = 2

    When we do a two-way ANOVA, we will obtain three different

    statistical tests:

    1. Main effect of IV1: Gender of Victim

    2. Main effect of IV2: # of Bystanders Present

    3. Interaction b/n the two IVs (gender & # of bystanders)

    Chapter 17: Page 9

  • 8/6/2019 Chapter 17 Two-way Anova

    10/43

    Each is a hypothesis test:

    Gender Main Effect:

    H0: all levels of gender have the same mean

    H1: all levels of gender do not have the same mean

    Bystander Main Effect:H0: all levels of bystander have the same mean

    H1: all levels of bystander do not have the same mean

    Interaction:

    H0: there is no interaction between the factorsH1: there is an interaction between the factors

    Chapter 17: Page 10

  • 8/6/2019 Chapter 17 Two-way Anova

    11/43

    Main Effects

    Defined: The effect of ONE IV on the DV averaged across the levels of theother IV

    In our example:

    --Main effect of gender: Is there a difference in response time for male

    versus female victims, averaging over the number of bystanders present?

    That is: Ignoring the number of bystanders, does response time differ for

    male versus female victims?

    --Main effect of # of bystanders: Is there a difference in response time when

    there is 1 versus 2 versus 3 bystanders present, averaging over the victimsgender?

    That is: Ignoring the gender of the victim, does response time differ based

    on the number of bystanders present?

    Chapter 17: Page 11

  • 8/6/2019 Chapter 17 Two-way Anova

    12/43

    One way to understand main effects is to examine something

    called marginal means

    P + 2 people P + 1 person P + 0 people Marginal

    Means

    Male victim

    X = 9 X = 8 X = 3 X = 6.67Female victim

    X = 4 X = 4 X = 2 X = 3.33

    Marginal MeansX = 6.5 X = 6 X = 2.5

    Chapter 17: Page 12

    Response time

    for 3bystanders,

    averaging over

    gender

    (9 + 4) / 2 = 6.5

    Response time

    for 2bystanders,

    averaging over

    gender

    (8 + 4) / 2 = 6

    Response timefor 1 bystander,

    averaging over

    gender

    (3 + 2) / 2 = 2.5

    Response time for

    male victims,

    averaging over # of

    bystanders

    (9 + 8 + 3) / 3 =

    6.67

    Response time for

    female victims,

    averaging over # of

    bystanders

    (4 + 4 + 2) / 3 =

    3.33

  • 8/6/2019 Chapter 17 Two-way Anova

    13/43

    A main effect of gender asks:

    Do the marginal means of 6.67 (male victims) and 3.33 (female

    victims) differ?

    A main effect of # of bystanders asks:

    Do the marginal means of 6.5 (3 bystanders), 6 (2 bystanders), &

    2.5 (1 bystander) differ?

    Chapter 17: Page 13

  • 8/6/2019 Chapter 17 Two-way Anova

    14/43

    Calculations

    To perform all the calculations for Sums of Squares for a two-way

    anova by hand is time and labor intensive

    These are almost exclusively done using the aid of a statistical

    package, like SPSS

    Thus, Ill just explain the calculations conceptually

    Chapter 17: Page 14

  • 8/6/2019 Chapter 17 Two-way Anova

    15/43

    Calculations: Main Effects Sums of Squares

    Calculations for main effects SS in a two-way ANOVA are very similar to thecalculations we used in one-way ANOVA

    Conceptually, to calculate the SS for a main effect, one is comparing each

    marginal mean to the overall (grand) mean

    P + 2 people P + 1 person P + 0 people Marginal Means

    Male victimX = 9 X = 8 X = 3 X = 6.67

    Female victimX = 4 X = 4 X = 2 X = 3.33

    Marginal MeansX = 6.5 X = 6 X = 2.5

    Overall: 5

    For a main effect of # of bystanders, one is taking the squared difference b/n:

    The mean from 3 bystanders & the overall mean (6.5 5)The mean from 2 bystanders & the overall mean (6-5)

    The mean from 1 bystander & the overall mean (2.5 5)

    These squared differences are multiplied by the # of scores per mean

    Chapter 17: Page 15

  • 8/6/2019 Chapter 17 Two-way Anova

    16/43

    For a main effect of gender, one is taking the squared difference b/n:

    The mean from male victims & the overall mean (6.67 5)The mean from female victims & the overall mean (3.33-5)

    These squared differences are multiplied by the # of scores per mean

    Calculations: Sums of SquaresTotal

    The Total SS is calculated by summing the squared deviations

    between each score and the overall grand mean

    Chapter 17: Page 16

  • 8/6/2019 Chapter 17 Two-way Anova

    17/43

    Calculations: Sums of SquaresCells

    The SS Cells is calculated by summing the squared deviations

    between each cell mean and the overall grand mean

    Each deviation is weighted by the number of observations in that

    cell

    Why would we want this?

    Cell means could differ b/c:

    1. They come from different levels of gender

    2. They come from different levels of # of bystanders

    3. There is an interaction b/n gender & # of bystanders

    Chapter 17: Page 17

  • 8/6/2019 Chapter 17 Two-way Anova

    18/43

    SS cells is made up of 3 parts:

    SS gender

    SS # of bystanders

    SS interaction

    We can calculate SS gender & SS # of bystanders directly

    Then, to find SS interaction:

    SS interaction = SS cells SS gender SS # of bystanders

    Chapter 17: Page 18

  • 8/6/2019 Chapter 17 Two-way Anova

    19/43

    Calculations: Sums of SquaresError

    The SS error is whats left over

    Of the total SS, we know what is due to gender (SS gender), what

    is due to the # of bystanders (SS bystanders) and what is due

    to the interaction (SS interaction). Thus:

    SSerror= SStotal (SSgender + SSbystanders + SSinteraction)

    Chapter 17: Page 19

  • 8/6/2019 Chapter 17 Two-way Anova

    20/43

    ANOVA Table

    Source df SS MS FGender

    # of Bystanders

    Interaction (G*B)

    ErrorTotal

    Chapter 17: Page 20

  • 8/6/2019 Chapter 17 Two-way Anova

    21/43

    Calculations: Degrees of Freedom

    dftotal = N 1

    (where N is the total sample size of the entire experiment)

    dfgender = k 1 (where k is the # of gender levels)

    dfbystanders = k 1 (where k is the # of bystander levels)

    dfinteraction = dfgender * dfbystanders

    (Product of the df for the two IVs)

    dferror= dftotal - dfgender - dfbystanders - dfinteraction

    Chapter 17: Page 21

  • 8/6/2019 Chapter 17 Two-way Anova

    22/43

    Calculations: Mean Squares

    To find any MS, take the SS & divide by its corresponding df

    MSGender = GenderGender

    df

    SS

    MSBystanders = dersBysdersBys

    df

    SS

    tan

    tan

    MSInteraction = nInteractionInteractio

    df

    SS

    MSError =Error

    Error

    df

    SS

    Chapter 17: Page 22

  • 8/6/2019 Chapter 17 Two-way Anova

    23/43

    Calculations: F statistics

    To find the 3 F statistics for our tests, take the MS for the 2 IVs &the MS for the interaction & divide them by the MSError

    FGender =Error

    Gender

    MS

    MS

    FBystanders =Error

    dersBys

    MS

    MStan

    FInteraction= ErrornInteractio

    MS

    MS

    Chapter 17: Page 23

  • 8/6/2019 Chapter 17 Two-way Anova

    24/43

    Calculations: Critical Values

    To determine if a particular F statistic is statistically significant,

    you obtain the appropriate critical value from Table E.3 or E.4

    For each F, you have two df: one for the corresponding factor and

    the dfErrorAs usual, if the obtained F value equals or exceeds the critical

    value, then we reject the null hypothesis and conclude that we

    have a statistically significant effect

    Chapter 17: Page 24

  • 8/6/2019 Chapter 17 Two-way Anova

    25/43

    Tests of Between-Subjects Effects

    Dependent Variable: How long do P wait to help?

    200.000a 5 40.000 17.778 .000

    750.000 1 750.000 333.333 .000

    83.333 1 83.333 37.037 .000

    95.000 2 47.500 21.111 .000

    21.667 2 10.833 4.815 .017

    54.000 24 2.250

    1004.000 30254.000 29

    SourceCorrected Model

    Intercept

    GENDER

    BYSTAND

    GENDER * BYSTAND

    Error

    TotalCorrected Total

    Type III Sumof Squares df Mean Square F Sig.

    R Squared = .787 (Adjusted R Squared = .743)a.

    Interpreting SPSS Output

    Chapter 17: Page 25

    Between-Subjects Factors

    15

    15

    10

    10

    10

    f

    m

    Gender of

    Victim

    1.00

    2.00

    3.00

    # of bystanders

    present

    N

    Main

    effect of

    gender

    Main effect

    of

    bystanders

    Interaction

    between

    gender &

    bystanders

  • 8/6/2019 Chapter 17 Two-way Anova

    26/43

    Estimated Marginal Means

    . Gender of Victim1

    Dependent Variable: How long do P wait to help?

    .3333 .387 .2534 .4133

    .6667 .387 .5867 .7466

    Gender of Victim

    f

    m

    Mean Std. Error Lower Bound Upper Bound

    % Confidence Interval95

    . # of bystanders present2

    Dependent Variable: How long do P wait to help?

    .2500 .474 .1521 .3479

    .6000 .474 .5021 .6979

    .6500 .474 .5521 .7479

    # of bystanders present

    .100

    .200

    .300

    Mean Std. Error Lower Bound Upper Bound

    % Confidence Interval95

    Chapter 17: Page 26

    There was a

    main effect

    of gender, sothese means

    differ

    There was a

    main effect

    of bystander,

    so there is a

    difference

    among these

    means

  • 8/6/2019 Chapter 17 Two-way Anova

    27/43

    . Gender of Victim * # of bystanders present3

    Dependent Variable: How long do P wait to help?

    .2000 .671 .615 .3385

    .4000 .671 .2615 .5385

    .4000 .671 .2615 .5385

    .3000 .671 .1615 .4385

    .8000 .671 .6615 .9385

    .9000 .671 .7615 .10385

    # of bystanders present

    .100

    .200

    .300

    .100

    .200

    .300

    Gender of Victim

    f

    m

    Mean Std. Error Lower Bound Upper Bound

    % Confidence Interval95

    Chapter 17: Page 27

    There was a significant

    interaction, so the

    effect of bystander

    depends on the level of

    gender

  • 8/6/2019 Chapter 17 Two-way Anova

    28/43

    Multiple-comparison procedures: Post-hoc tests VS simple effects

    Understanding Main Effects

    If there is a significant main effect, & that factor has only two levels, you knowthat those two marginal means differ significantly from each other

    If there is a significant main effect, & that factor has 3 or more levels, youknow that at least two of those marginal means differ. Need multiple-comparison procedures (post-hocs) to determine which ones.

    Can be obtained in SPSS

    Chapter 17: Page 28

  • 8/6/2019 Chapter 17 Two-way Anova

    29/43

    Post Hoc Tests: # of bystanders presentMultiple Comparisons

    Dependent Variable: How long do P wait to help?

    LSD

    - .35000* .6708 .000 - .48845 - .21155

    - .40000* .6708 .000 - .53845 - .26155

    .35000* .6708 .000 .21155 .48845

    -.5000 .6708 .463 - .18845 .8845.40000* .6708 .000 .26155 .53845

    .5000 .6708 .463 -.8845 .18845

    (J) # of bystanders

    present

    .200

    .300

    .100

    .300

    .100

    .200

    (I) # of bystanders

    present

    .100

    .200

    .300

    Mean

    Difference

    (I-J) Std. Error Sig. Lower Bound Upper Bound

    % Confidence Interval95

    Based on observed means.

    The mean difference is significant at the . level.05*.

    Chapter 17: Page 29

    1 bystander

    differs from2

    1 bystander

    differs from

    3

    2 bystanders

    DO NOT

    differ from 3

  • 8/6/2019 Chapter 17 Two-way Anova

    30/43

    Multiple-comparison procedures: Post-hoc tests VS simple effects

    Understanding Interactions

    An interaction occurs when the effect of one IV depends on the level of the

    other IV

    If you obtain a significant interaction, you may want to examine it closely to seewhat is causing it

    A useful first step is to graph the means to see the pattern of the interaction

    Can be obtained in SPSS or done by hand

    Chapter 17: Page 30

  • 8/6/2019 Chapter 17 Two-way Anova

    31/43

    You could graph the means two different ways:

    Estimated Marginal Means of How long do P wait to help?

    Gender of Victim

    mf

    EstimatedMargin

    alMeans

    10

    8

    6

    4

    2

    0

    # of bystanders pres

    .100

    .200

    .300

    Graphed this way, we see that the bystander effect seems smaller for female

    victims compared to male victims

    Chapter 17: Page 31

  • 8/6/2019 Chapter 17 Two-way Anova

    32/43

    Estimated Marginal Means of How long do P wait to hel

    # of bystanders present

    .300.200.100

    EstimatedMarginalMeans

    10

    8

    6

    4

    2

    0

    Gender of Victim

    f

    m

    Graphed this way, we see that male and female victims get helped about equally

    quickly with one bystander present, but when multiple bystanders arepresent, a gender difference emerges

    Chapter 17: Page 32

  • 8/6/2019 Chapter 17 Two-way Anova

    33/43

    Understanding Interactions

    Another thing to do to understand an interaction is to calculate simple effects

    The effect of one IV at one level of another IV

    Can be done in SPSS using Syntax

    Chapter 17: Page 33

  • 8/6/2019 Chapter 17 Two-way Anova

    34/43

    Simple effects of gender at each level of bystander:

    Univariate Tests

    Dependent Variable: How long do P wait to help?

    .2500 1 .2500 .1111 .302

    .54000 24 .2250

    .40000 1 .40000 .17778 .000

    .54000 24 .2250

    .62500 1 .62500 .27778 .000

    .54000 24 .2250

    Contrast

    Error

    Contrast

    Error

    Contrast

    Error

    # of bystanders present

    .100

    .200

    .300

    Sum of

    Squares df Mean Square F Sig.

    Each F tests the simple effects of Gender of Victim within each level combination of the other effects

    shown. These tests are based on the linearly independent pairwise comparisons among the estimated

    marginal means.

    Chapter 17: Page 34

    There is a difference

    between male and femalevictims in response time

    when 2 or 3 bystanders

    are present

    There is a difference

    between male and femalevictims in response time

    when 2 or 3 bystanders

    are present

    There is no difference in

    response time for male and

    female victims when only

    1 bystander is present

  • 8/6/2019 Chapter 17 Two-way Anova

    35/43

    Simple effects of bystander at each level of gender:

    Univariate Tests

    Dependent Variable: How long do P wait to help?

    .13333 2 .6667 .2963 .071

    .54000 24 .2250

    .103333 2 .51667 .22963 .000

    .54000 24 .2250

    Contrast

    Error

    Contrast

    Error

    Gender of Victim

    f

    m

    Sum of

    Squares df Mean Square F Sig.

    Each F tests the simple effects of # of bystanders present within each level combination of theother effects shown. These tests are based on the linearly independent pairwise comparisons

    among the estimated marginal means.

    Chapter 17: Page 35

    There is a difference amongthe levels of bystander for

    male victims. There is no

    such difference for female

    victims

    There is a difference amongthe levels of bystander for

    male victims. There is no

    such difference for female

    victims

  • 8/6/2019 Chapter 17 Two-way Anova

    36/43

    Interpretation

    Reporting the results of a two-way anova is complex because there are so manytests conducted. Below is one way you might report the results of the

    above analyses:

    Chapter 17: Page 36

  • 8/6/2019 Chapter 17 Two-way Anova

    37/43

    An experiment was conducted to determine if the number of bystanders present

    in an emergency situation and the gender of the victim in an emergency

    situation affect the time it takes a person to help. A two-way ANOVAfound a main effect of gender,F(1,24)=37.037,p .05, indicating thatfemale victims are helped sooner than male victims. There was also a

    main effect of the number of bystanders present,F(2,24)=21.111,p .05.This effect showed that a lone bystander helped much sooner than when

    there were 2 or 3 bystanders present. Finally, there was an interaction

    between gender and the number of bystanders present,F(2,24)=4.815,p .05. Simple effects tests showed that male and female victims receive

    help equally quickly when only 1 bystander is present,F(1,24)=1.11,p> .05. However, when 2 or 3 bystanders are present, female victims were

    helped more quickly than male victims,F(1,24)=17.778,p .05 for 2bystanders andF(1,24)=27.778,p .05 for 3 bystanders.

    Chapter 17: Page 37

  • 8/6/2019 Chapter 17 Two-way Anova

    38/43

    Filling in an ANOVA Table

    You should be able to complete a partially filled in ANOVA table

    Lets suppose we did an experiment where we investigate the effectiveness of

    advertisements. We manipulate:

    IV1: Whether the ad has a celebrity spokesperson or a normal person

    IV2: Whether the ad is in black/white or color

    DV: How persuasive do Ps find the ad on a scale where 1 = Not at all persuaded;

    7 = Extremely persuaded

    There are 20 participants per cell

    Chapter 17: Page 38

  • 8/6/2019 Chapter 17 Two-way Anova

    39/43

    ANOVA Table

    Source df SS MS FSpokesperson 200

    Color 150

    Interaction (S*C) 50

    ErrorTotal 850

    We should be able to complete everything else!

    Calculate df

    Spokesperson has 2 levels df = (k 1) = (2 1) = 1Color has 2 levels df = (k 1) = (2 1) = 1

    Interaction df is the product of the df for the 2 IVs = 1*1 = 1

    Total df = (N 1) = (80-1) = 79

    Error df = whats left over (79 1 1 1) = 76

    Chapter 17: Page 39

  • 8/6/2019 Chapter 17 Two-way Anova

    40/43

    Source df SS MS FSpokesperson 1 200

    Color 1 150

    Interaction (S*C) 1 50

    Error 76

    Total 79 850

    The SS for all factors and interactions should add up to the totalSS. Thus:

    SSerror= SStotal SSspokesperson SScolor- SSinteraction

    SSerror= 850 200 150 50 = 450

    Chapter 17: Page 40

  • 8/6/2019 Chapter 17 Two-way Anova

    41/43

    Source df SS MS FSpokesperson 1 200

    Color 1 150

    Interaction (S*C) 1 50

    Error 76 450

    Total 79 850

    MSSpokesperson = 2001200

    ==

    onspokespers

    onspokespers

    df

    SSMScolor= 1501

    150==

    color

    color

    dfSS

    MSInteraction = 50150

    ==

    nInteractio

    nInteractio

    df

    SS

    MSError = 92.576450

    ==

    Error

    Error

    df

    SS

    Chapter 17: Page 41

  • 8/6/2019 Chapter 17 Two-way Anova

    42/43

    Source df SS MS FSpokesperson 1 200 200

    Color 1 150 150

    Interaction (S*C) 1 50 50

    Error 76 450 5.92

    Total 79 850

    FSpokesperson = 7.3392.5200

    ==

    Error

    onSpokespers

    MS

    MSFColor = 34.2592.5

    150==Error

    Color

    MSMS

    FInteraction = 45.892.550

    ==

    Error

    nInteractio

    MS

    MS

    Chapter 17: Page 42

  • 8/6/2019 Chapter 17 Two-way Anova

    43/43

    Source df SS MS FSpokesperson 1 200 200 33.78

    Color 1 150 150 25.34

    Interaction (S*C) 1 50 50 8.45

    Error 76 450 5.92

    Total 79 850

    Finally, wed compare each F to the appropriate critical F value

    All tests in this example have 1,76 df. Assuming = .05, from

    Table E.3, well use the df that are closest to but smaller than

    the actual df, b/c they are not listed

    Thus, we will use the df for (1,60) = 4.00

    All Fs exceed the critical value

    Chapter 17: Page 43