Presentation is loading. Please wait.

Presentation is loading. Please wait.

ANOVA PSY440 June 26, 2008. Clarification: Null & Alternative Hypotheses Sometimes the null hypothesis is that some value is zero (e.g., difference between.

Similar presentations


Presentation on theme: "ANOVA PSY440 June 26, 2008. Clarification: Null & Alternative Hypotheses Sometimes the null hypothesis is that some value is zero (e.g., difference between."— Presentation transcript:

1 ANOVA PSY440 June 26, 2008

2 Clarification: Null & Alternative Hypotheses Sometimes the null hypothesis is that some value is zero (e.g., difference between groups), or that groups are equal Sometimes the null hypothesis is the opposite of what you are “hoping” or “expecting” to find based on theory It is usually (if not always) that “nothing interesting, special, or unusual is going on here.” If you are confused, look for the “nothing special” hypothesis, and that is usually H 0

3 Clarification: Null & Alternative Hypotheses Examples of the “nothing special” H 0 –These proportions aren’t unusual, they are what previous literature has typically found. There’s nothing unusual about my sample (could be that proportions are equal or unequal, depends on what constitutes “nothing special”) –The mean score in my sample isn’t unusual - it is no different from the mean I would expect, based on what I know about the population (could be that the expected mean is 0, could be that it is some positive or negative number - depends on what constitutes “nothing special”) –The two groups have equal means - nothing special about the experimental condition (this is the more intuitive scenario) Sometimes you “want” to reject H 0, other times you are more interested in “ruling out” unexpected alternatives.

4 Review: Assumptions of the t-test Each of the population distributions follows a normal curve The two populations have the same variance If the variance is not equal, but the sample sizes are equal or very close, you can still use a t-test If the variance is not equal and the samples are very different in size, use the corrected degrees of freedom provided after Levene’s test (see spss output)

5 Using spss to conduct t-tests One-sample t-test: Analyze =>Compare Means =>One sample t-test. Select the variable you want to analyze, and type in the expected mean based on your null hypothesis. Paired or related samples t-test: Analyze =>Compare Means =>Paired samples t-test. Select the variables you want to compare and drag them into the “pair 1” boxes labeled “variable 1” and “variable 2” Independent samples t-test: Analyze =>Compare Means =>Independent samples t-test. Specify test variable and grouping variable, and click on define groups to specify how grouping variable will identify groups.

6 Using excel to compute t-tests =t-test(array1,array2,tails,type) Select the arrays that you want to compare, specify number of tails (1 or 2) and type of t-test (1=dependent, 2=independent w/equal variance assumed, 3=independent w/unequal variance assumed). Returns the p-value associated with the t- test.

7 t-tests and the General Linear Model Think of grouping variable as x and “test variable” as y in a regression analysis. Does knowing what group a person is in help you predict their score on y? If you code the grouping variable as a binary numeric variable (e.g., group 1=0 and group 2=1), and run a regression analysis, you will get similar results as you would get in an independent samples t-test! (try it and see for yourself)

8 Conceptual Preview of ANOVA Thinking in terms of the GLM, the t-test is telling you how big the variance or difference between the two groups is, compared to the variance in your y variable (between vs. within group variance). In terms of regression, how much can you reduce “error” (or random variability) by looking at scores within groups rather than scores for the entire sample?

9 Effect Size for t Test for Independent Means Estimated effect size after a completed study

10 Statistical Tests Summary DesignStatistical test (Estimated) Standard error One sample,  known One sample,  unknown Two related samples,  unknown Two independent samples,  unknown

11 New Topic: Analysis of Variance (ANOVA) Basics of ANOVA Why Computations ANOVA in SPSS Post-hoc and planned comparisons Assumptions The structural model in ANOVA

12 Example Effect of knowledge of prior behavior on jury decisions –Dependent variable: rate how innocent/guilty –Independent variable: 3 levels Criminal record Clean record No information (no mention of a record)

13 Statistical analysis follows design The 1 factor between groups ANOVA: –More than two –Independent & One score per subject –1 independent variable

14 Analysis of Variance XBXB XAXA XCXC Criminal recordClean recordNo information 1054 716 539 73 843 More than two groups –Now we can’t just compute a simple difference score since there are more than one difference Generic test statistic

15 Analysis of Variance XBXB XAXA XCXC Criminal recordClean recordNo information 1054 716 539 73 843 –Need a measure that describes several difference scores –Variance Variance is essentially an average squared difference Test statistic Observed variance Variance from chance F-ratio = More than two groups

16 Testing Hypotheses with ANOVA –Step 1: State your hypotheses Hypothesis testing: a five step program Null hypothesis (H 0 ) –All of the populations all have same mean Alternative hypotheses (H A ) –Not all of the populations all have same mean –There are several alternative hypotheses –We will return to this issue later

17 Testing Hypotheses with ANOVA –Step 2: Set your decision criteria –Step 3: Collect your data –Step 4: Compute your test statistics Compute your estimated variances Compute your F-ratio Compute your degrees of freedom (there are several) –Step 5: Make a decision about your null hypothesis Hypothesis testing: a five step program –Step 1: State your hypotheses –Additional tests Reconciling our multiple alternative hypotheses

18 Step 4: Computing the F-ratio Analyzing the sources of variance –Describe the total variance in the dependent measure Why are these scores different? XBXB XAXA XCXC Two sources of variability –Within groups –Between groups

19 Step 4: Computing the F-ratio Within-groups estimate of the population variance –Estimating population variance from variation from within each sample Not affected by whether the null hypothesis is true XBXB XAXA XCXC Different people within each group give different ratings Different people within each group give different ratings

20 Between-groups estimate of the population variance –Estimating population variance from variation between the means of the samples Is affected by the null hypothesis is true Step 4: Computing the F-ratio XBXB XAXA XCXC There is an effect of the IV, so the people in different groups give different ratings There is an effect of the IV, so the people in different groups give different ratings

21 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Note: we will start with SS, but will get to variance Note: we will start with SS, but will get to variance

22 Partitioning the variance Total variance Criminal recordClean recordNo information 1054 716 539 73 843 Basically forgetting about separate groups –Compute the Grand Mean (GM) –Compute squared deviations from the Grand Mean

23 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance

24 Partitioning the variance Within groups variance Criminal recordClean recordNo information 1054 716 539 73 843 Basically the variability in each group –Add up of the SS from all of the groups

25 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance

26 Partitioning the variance Between groups variance Criminal recordClean recordNo information 1054 716 539 73 843 Basically how much each group differs from the Grand Mean –Subtract the GM from each group mean –Square the diffs –Weight by number of scores

27 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance

28 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Now we return to variance. But, we call it Means Square (MS) Now we return to variance. But, we call it Means Square (MS) Recall:

29 Partitioning the variance Mean Squares (Variance) Within groups variance Between groups variance

30 The F ratio –Ratio of the between-groups to the within-groups population variance estimate Step 4: Computing the F-ratio The F distribution The F table Observed variance Variance from chance F-ratio = Do we reject or fail to reject the H 0 ? Do we reject or fail to reject the H 0 ?

31 Carrying out an ANOVA The F distributionThe F tableThe F table –Need two df’s df between (numerator) df within (denominator) –Values in the table correspond to critical F’s Reject the H 0 if your computed value is greater than or equal to the critical F –Separate tables for 0.05 & 0.01

32 Carrying out an ANOVA The F tableThe F table –Need two df’s df between (numerator) df within (denominator) –Values in the table correspond to critical F’s Reject the H 0 if your computed value is greater than or equal to the critical F –Separate tables for 0.05 & 0.01 Do we reject or fail to reject the H 0 ? Do we reject or fail to reject the H 0 ? –From the table (assuming 0.05) with 2 and 12 degrees of freedom the critical F = 3.89. –So we reject H 0 and conclude that not all groups are the same

33 Assumptions in ANOVA Populations follow a normal curve Populations have equal variances

34 Planned Comparisons Reject null hypothesis –Population means are not all the same Planned comparisons –Within-groups population variance estimate –Between-groups population variance estimate Use the two means of interest –Figure F in usual way

35 1 factor ANOVA Null hypothesis: H 0 : all the groups are equal XBXB XAXA XCXC X A = X B = X C Alternative hypotheses H A : not all the groups are equal X A ≠ X B ≠ X C X A ≠ X B = X C X A = X B ≠ X C X A = X C ≠ X B The ANOVA tests this one!!

36 1 factor ANOVA Planned contrasts and post-hoc tests: - Further tests used to rule out the different Alternative hypotheses X A ≠ X B ≠ X C X A ≠ X B = X C X A = X B ≠ X C X A = X C ≠ X B Test 1: A ≠ B Test 2: A ≠ C Test 3: B = C

37 Planned Comparisons Simple comparisons Complex comparisons Bonferroni procedure –Use more stringent significance level for each comparison

38 Controversies and Limitations Omnibus test versus planned comparisons –Conduct specific planned comparisons to examine Theoretical questions Practical questions –Controversial approach

39 ANOVA in Research Articles F(3, 67) = 5.81, p <.01 Means given in a table or in the text Follow-up analyses –Planned comparisons Using t tests

40 1 factor ANOVA Reporting your results –The observed difference –Kind of test –Computed F-ratio –Degrees of freedom for the test –The “p-value” of the test –Any post-hoc or planned comparison results “The mean score of Group A was 12, Group B was 25, and Group C was 27. A 1-way ANOVA was conducted and the results yielded a significant difference, F(2,25) = 5.67, p < 0.05. Post hoc tests revealed that the differences between groups A and B and A and C were statistically reliable (respectively t(1) = 5.67, p < 0.05 & t(1) = 6.02, p <0.05). Groups B and C did not differ significantly from one another”

41 The structural model and ANOVA The structural model is all about deviations Score (X) Group mean (M) Grand mean (GM) Score’s deviation from group mean (X-M) Group’s mean’s deviation from grand mean (M-GM) Score’s deviation from grand mean (X-GM)

42 Why do the ANOVA? What’s the big deal? Why not just run a bunch of t-tests instead of doing an ANOVA? –Experiment-wise error –The type I error rate of the family (the entire set) of comparisons  EW = 1 - (1 -  )c where c = # of comparisons »e.g., If you conduct two t-tests, each with an alpha level of 0.05, the combined chance of making a type I error is nearly 10 in 100 (rather than 5 in 100) –Planned comparisons and post hoc tests are procedures designed to reduce experiment-wise error

43 Which follow-up test? Planned comparisons –A set of specific comparisons that you “planned” to do in advance of conducting the overall ANOVA –General rule of thumb, don’t exceed the number of conditions that you have (or even stick with one fewer) Post-hoc tests –A set of comparisons that you decided to examine only after you find a significant (reject H 0 ) ANOVA

44 Planned Comparisons Different types –Simple comparisons - testing two groups –Complex comparisons - testing combined groups –Bonferroni procedure Use more stringent significance level for each comparison Basic procedure: –Within-groups population variance estimate (denominator) –Between-groups population variance estimate of the two groups of interest (numerator) –Figure F in usual way

45 Post-hoc tests Generally, you are testing all of the possible comparisons (rather than just a specific few) –Different types Tukey’s HSD test Scheffe test Others (Fisher’s LSD, Neuman-Keuls test, Duncan test) –Generally they differ with respect to how conservative they are.

46 Planned Comparisons & Post-Hoc Tests as Contrasts A contrast is basically a way of assigning numeric values to your grouping variable in a manner that allows you to test a specific difference between two means (or between one mean and a weighted average of two or more other means). Discuss numbers Discuss “orthogonal” contrasts

47 Fixed vs. Random Factors in ANOVA One-way ANOVAs can use grouping variables that are fixed or random. –Fixed: All levels of the variable of interest are represented by the variable (e.g., treatment and control, male and female). –Random: The grouping variable represents a random selection of levels of that variable, sampled from a population of levels (e.g., observers). –For one-way ANOVA, the math is the same either way, but the logic of the test is a little different. (Testing either that means are equal or that the between group variance is 0)

48 Effect sizes in ANOVA The effect size for ANOVA is r 2 –Sometimes called  2 (“eta squared”) –The percent of the variance in the dependent variable that is accounted for by the independent variable –Size of effect depends, in part, on degrees of freedom

49 ANOVA in SPSS Let’s see how to do a between groups 1-factor ANOVA in SPSS (and the other tests too)

50 Within groups (repeated measures) ANOVA Basics of within groups ANOVA –Repeated measures –Matched samples Computations Within groups ANOVA in SPSS

51 Example Suppose that you want to compare three brand name pain relievers. –Give each person a drug, wait 15 minutes, then ask them to keep their hand in a bucket of cold water as long as they can. The next day, repeat (with a different drug) Dependent variable: time in ice water Independent variable: 4 levels, within groups –Placebo –Drug A –Drug B –Drug C

52 Statistical analysis follows design The 1 factor within groups ANOVA: –One group –Repeated measures –More than 2 scores per subject

53 Statistical analysis follows design The 1 factor within groups ANOVA: –One group –Repeated measures –More than 2 scores per subject –More than 2 groups –Matched samples –Matched groups - OR -

54 Within-subjects ANOVA PlaceboDrug ADrug BDrug C 3467 0336 2145 0134 0143 XBXB XAXA XCXC XPXP n = 5 participants Each participates in every condition (4 of these)

55 Within-subjects ANOVA –Step 2: Set your decision criteria –Step 3: Collect your data –Step 4: Compute your test statistics Compute your estimated variances (2 steps of partitioning used) Compute your F-ratio Compute your degrees of freedom (there are even more now) –Step 5: Make a decision about your null hypothesis Hypothesis testing: a five step program –Step 1: State your hypotheses

56 Step 4: Computing the F-ratio Analyzing the sources of variance –Describe the total variance in the dependent measure Why are these scores different? Sources of variability –Between groups –Within groups XBXB XAXA XCXC XPXP Individual differences Left over variance (error) Because we use the same people in each condition, we can figure out how much of the variability comes from the individuals and remove it from the analysis

57 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance

58 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Stage 2 Between subjects varianceError variance

59 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Stage 2 Between subjects varianceError variance 1)Treatment effect 2)Error or chance (without individual differences) 1)Individual differences 2)Other error 1)Other error (without individual differences) 1)Individual differences Because we use the same people in each condition, none of this variability comes from having different people in different conditions

60 The F ratio –Ratio of the between-groups variance estimate to the population error variance estimate Step 4: Computing the F-ratio Observed variance Variance from chance F-ratio =

61 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Stage 2 Between subjects varianceError variance 1)Treatment effect 2)Error or chance (without individual differences) 1)Individual differences 2)Other error 1)Other error (without individual differences) 1)Individual differences

62 Partitioning the variance Total variance Stage 1 Between groups varianceWithin groups variance

63 Partitioning the variance PlaceboDrug ADrug BDrug C 3467 0336 2145 0134 0143

64 Partitioning the variance Total variance Stage 1 Between groups varianceWithin groups variance Stage 2 Between subjects varianceError variance

65 What is ? Partitioning the variance PlaceboDrug ADrug BDrug C 3467 0336 2145 0134 0143 The average score for each person Between subjects variance

66 Partitioning the variance PlaceboDrug ADrug BDrug C 3467 0336 2145 0134 0143 What is ? The average score for each person Between subjects variance

67 Partitioning the variance Total variance Stage 1 Between groups varianceWithin groups variance Stage 2 Between subjects variance Error variance

68 Partitioning the variance PlaceboDrug ADrug BDrug C 3467 0336 2145 0134 0143 Error variance

69 Partitioning the variance Total variance Stage 1 Between groups varianceWithin groups variance Stage 2 Between subjects variance Error variance

70 Partitioning the variance Mean Squares (Variance) Between groups varianceError variance Now we return to variance. But, we call it Means Square (MS) Now we return to variance. But, we call it Means Square (MS) Recall:

71 Partitioning the variance Total variance Stage 1 Between groups varianceWithin groups variance Stage 2 Between subjects variance Error variance

72 Within-subjects ANOVA The F tableThe F table –Need two df’s df between (numerator) df error (denominator) –Values in the table correspond to critical F’s Reject the H 0 if your computed value is greater than or equal to the critical F –Separate tables for 0.05 & 0.01 Do we reject or fail to reject the H 0 ? Do we reject or fail to reject the H 0 ? –From the table (assuming 0.05) with 3 and 12 degrees of freedom the critical F = 3.89. –So we reject H 0 and conclude that not all groups are the same

73 Within-subjects ANOVA in SPSS –Setting up the file –Running the analysis –Looking at the output

74 Factorial ANOVA Basics of factorial ANOVA –Interpretations Main effects Interactions –Computations –Assumptions, effect sizes, and power –Other Factorial Designs More than two factors Within factorial ANOVAs

75 Statistical analysis follows design The factorial (between groups) ANOVA: –More than two groups –Independent groups –More than one Independent variable

76 Factorial experiments Two or more factors –Factors - independent variables –Levels - the levels of your independent variables 2 x 3 design means two independent variables, one with 2 levels and one with 3 levels “condition” or “groups” is calculated by multiplying the levels, so a 2x3 design has 6 different conditions B1B2B3 A1 A2

77 Factorial experiments Two or more factors (cont.) –Main effects - the effects of your independent variables ignoring (collapsed across) the other independent variables –Interaction effects - how your independent variables affect each other Example: 2x2 design, factors A and B Interaction: –At A1, B1 is bigger than B2 –At A2, B1 and B2 don’t differ

78 Results So there are lots of different potential outcomes: A = main effect of factor A B = main effect of factor B AB = interaction of A and B With 2 factors there are 8 basic possible patterns of results: 5) A & B 6) A & AB 7) B & AB 8) A & B & AB 1) No effects at all 2) A only 3) B only 4) AB only

79 2 x 2 factorial design Condition mean A1B1 Condition mean A2B1 Condition mean A1B2 Condition mean A2B2 A1A2 B2 B1 Marginal means B1 mean B2 mean A1 meanA2 mean Main effect of B Main effect of A Interaction of AB What’s the effect of A at B1? What’s the effect of A at B2?

80 Main effect of A Main effect of B Interaction of A x B A B A1 A2 B1 B2 Main Effect of A Main Effect of B 60 45 30 60 30 60 30 A A1 A2 Dependent Variable B1 B2 √ X X Examples of outcomes

81 Main effect of A Main effect of B Interaction of A x B A B A1 A2 B1 B2 Main Effect of A Main Effect of B 45 60 30 45 30 60 A A1 A2 Dependent Variable B1 B2 √ X X Examples of outcomes

82 Main effect of A Main effect of B Interaction of A x B A B A1 A2 B1 B2 Main Effect of A Main Effect of B 45 60 30 60 A A1 A2 Dependent Variable B1 B2 √ X X Examples of outcomes

83 Main effect of A Main effect of B Interaction of A x B A B A1 A2 B1 B2 Main Effect of A Main Effect of B 45 30 60 30 A A1 A2 Dependent Variable B1 B2 √ √ √ Examples of outcomes

84 Factorial Designs Benefits of factorial ANOVA (over doing separate 1- way ANOVA experiments) –Interaction effects –One should always consider the interaction effects before trying to interpret the main effects –Adding factors decreases the variability –Because you’re controlling more of the variables that influence the dependent variable –This increases the statistical Power of the statistical tests

85 Basic Logic of the Two-Way ANOVA Same basic math as we used before, but now there are additional ways to partition the variance The three F ratios –Main effect of Factor A (rows) –Main effect of Factor B (columns) –Interaction effect of Factors A and B

86 Partitioning the variance Total variance Stage 1 Between groups variance Within groups variance Stage 2 Factor A varianceFactor B varianceInteraction variance

87 Figuring a Two-Way ANOVA Sums of squares

88 Figuring a Two-Way ANOVA Degrees of freedom Number of levels of A Number of levels of B

89 Figuring a Two-Way ANOVA Means squares (estimated variances)

90 Figuring a Two-Way ANOVA F-ratios

91 Figuring a Two-Way ANOVA ANOVA table for two-way ANOVA

92 Example Factor B: Arousal Level Low B 1 Medium B 2 High B 3 FactorA: Task Difficulty A 1 Easy 3116431164 2597725977 0043100431 A 2 Difficult 3002030020 3833338333 0005000050

93 Example Factor B: Arousal Level Low B 1 Medium B 2 High B 3 FactorA: Task Difficulty A 1 Easy 3116431164 2597725977 0043100431 A 2 Difficult 3002030020 3833338333 0005000050

94 Example Factor B: Arousal Level Low B 1 Medium B 2 High B 3 FactorA: Task Difficulty A 1 Easy 3116431164 2597725977 0043100431 A 2 Difficult 3002030020 3833338333 0005000050

95 Example Factor B: Arousal Level Low B 1 Medium B 2 High B 3 FactorA: Task Difficulty A 1 Easy 3116431164 2597725977 0043100431 A 2 Difficult 3002030020 3833338333 0005000050

96 Example SourceSSdfMSF Between A B AB 120 60 122122 120 30 24.0 6.0 Within Total 120 360 245 √ √ √

97 Assumptions in Two-Way ANOVA Populations follow a normal curve Populations have equal variances Assumptions apply to the populations that go with each cell

98 Effect Size in Factorial ANOVA

99 Extensions & Special Cases of Factorial ANOVA Three-way and higher ANOVA designs Repeated measures ANOVA Mixed factorial ANOCA

100 Factorial ANOVA in Research Articles A two-factor ANOVA yielded a significant main effect of voice, F(2, 245) = 26.30, p <.001. As expected, participants responded less favorably in the low voice condition (M = 2.93) than in the high voice condition (M = 3.58). The mean rating in the control condition (M = 3.34) fell between these two extremes. Of greater importance, the interaction between culture and voice was also significant, F(2, 245) = 4.11, p <.02.

101 Repeated Measures & Mixed Factorial ANOVA Basics of repeated measures factorial ANOVA –Using SPSS Basics of mixed factorial ANOVA –Using SPSS Similar to the between groups factorial ANOVA –Main effects and interactions –Multiple sources for the error terms (different denominators for each main effect)

102 Example Suppose that you are interested in how sleep deprivation impacts performance. You test 5 people on two tasks (motor and math) over the course of time without sleep (24 hrs, 36 hrs, and 48 hrs). Dependent variable is number of errors in the tasks. –Both factors are manipulated as within subject variables –Need to conduct a within groups factorial ANOVA

103 Example Factor B: Hours awake 24 B 1 36 B 2 48 B 3 Factor A: Task A 1 Motor 0104001040 0315103151 6559565595 A 2 Math 1103111031 1212312123 4664446644

104 Example SourceSSdfMSF A Error (A) 1.20 13.13 1414 1.20 3.28 0.37 B Error (B) AB Error (AB) 104.60 6.10 2.60 8.10 28282828 52.30 0.76 1.30 1.01 69.00 1.29

105 Example It has been suggested that pupil size increases during emotional arousal. A researcher presents people with different types of stimuli (designed to elicit different emotions). The researcher examines whether similar effects are demonstrated by men and women. –Type of stimuli was manipulated within subjects –Sex is a between subjects variable –Need to conduct a mixed factorial ANOVA

106 Example Factor B: Stimulus Neutral B 1 Pleasant B 2 Aversive B 3 FactorA: Sex A 1 Men 4323343233 8653886538 3326133261 A 2 Women 3241332413 6467564675 2163221632

107 Example SourceSSdfMSF Between A Error (A) 0.83 20.00 1818 0.83 2.50 0.33 Within B AB Error (B) 58.10 0.07 39.20 2 16 29.00 0.03 2.45 11.85 0.01


Download ppt "ANOVA PSY440 June 26, 2008. Clarification: Null & Alternative Hypotheses Sometimes the null hypothesis is that some value is zero (e.g., difference between."

Similar presentations


Ads by Google