Oneway ANOVA Advanced Research Methods in Psychology - lecture - Matthew Rockloff 1 When to use a Oneway ANOVA 1 Oneway ANOVA is a generalization of the independent samples t-test. Recall that the independent samples ttest is used to compare the mean values of 2 different groups. A Oneway ANOVA does the same thing, but it has the advantage of allowing comparisons between more than 2 groups. 2 When to use a Oneway ANOVA 2 In psychology, for example, we often want to contrast several conditions in an experiment; such as a control, a standard treatment, and a newer “experimental” treatment. Because Oneway ANOVA is simply a generalization of the independent samples t-test, we use this procedure (to follow) to recalculate our previous 2 groups example. Later, we will do an example with more than 2 groups. 3 Example 7.1 Let’s return to our example of the pizza vs. beer diet. Our research question is: “Is there any weight gain difference between a 1-week exclusive diet of either pizza or beer?” 4 Example 7.1 (cont.) X1 Xj S2xj 1 2 2 2 3 =2 = 0.4 X2 3 4 4 4 5 4 0.4 5 Example 7.1 (cont.) An Oneway-ANOVA is a generalization of the independent samples t-test in which we can specify more than 2 conditions. If we only specify 2 conditions, however, the results will be exactly the same as the t-test. The calculations are somewhat different, but the resulting “p-value” will be the same, and therefore the research conclusion will always be the same. 6 Example 7.1 (cont.) ANOVA operates on the principle of “partitioning the variance”. There is a total amount of variance in the set of data previous. This total variance is found by subtracting each value (e.g., 1,2,2…) from the mean for all 10 people ( T 3), squaring the result, summing the squares, and dividing by the number of values (i.e., 10): 7 Example 7.1 - Formula S 2 t ( ) T 2 N or S 2 t 2 2 2 2 2 2 2 2 2 2 (1 - 3) (2 - 3) (2 - 3) (2 - 3) (3 - 3) (3 - 3) (4 - 3) (4 - 3) (4 - 3) (5 - 3) 10 8 1.4 Example 7.1 (cont.) This total variance (S2t=1.4) can be partitioned, or divided, into 2 parts: • the variance within, and • the variance between. 9 Example 7.1 – Variance within The variance within is calculated by averaging the variances within each condition. For the previous example 10 Example 7.1 – Variance within (cont) S 2 within S S 2 within J 2 xj , where J = number of conditions 0.4 0.4 0.4 2 11 Example 7.1 – Variance between The variance between is calculated by taking the variance of the means of all conditions. In our example, of course, we only have 2 means: S 2 between S 2 between Variance ( 1 , 2 ,... X J ) ( j T ) J or 2 for a balanced study. 12 Example 7.1 – Variance between (cont.) In our example: (2 3) (4 3) 1 2 2 S 2 between 2 13 Example 7.1 (cont.) Now we can write a formula for the partition of the variance into its components: S2total = S2between+S2within , or 1.4 = 1 + 0.4 The formula above will allow you to check your hand calculations. If you’ve done everything right, all variances should “add up” to the total variance. 14 Example 7.1 – ANOVA table Next, we need to fill-in the so-called ANOVA table: Source of Variance (SV) Source of Squares (SS) Degrees of Freedom (df) Mean Squares (MS) F-ratio (F) Critical Value (CV) Reject Decision (Reject?) Between N- J-1 SSb/dfb MSb/MSw See back of table of Stats Text Is F-ratio > CV ? SSw/dfw S2between Within N-S2within J(n-1) Total N-S2total N-1 15 Example 7.1 – ANOVA table (cont.) Here’s what we know so far: • S2between = 1 • S2within = 0.4 • S2total =1.4 • J=2 (because there are 2 conditions) • n=5 (because there are 5 people in each condition) • N=10 (because there are 10 subjects in total) 16 Example 7.1 – ANOVA table (cont.) Now we can fill-in the table: Source of Variance (SV) Source of Squares (SS) Degrees of Freedom (df) Mean Squares (MS) F-ratio (F) Critical Value (CV) Reject Decision (Reject?) Between 10(1)= 10 2-1= 1 10/1= 10 10/0.5= 20 5.32 Is F-ratio > CV ? YES Within 10(0.4)= 4 2(5-1)= 8 4/8= 0.5 Total 10(1.4)= 14 10-1= 9 17 Example 7.1 (cont.) This is a 2-tailed test because we had no notion of which diet should have greater weight gain. In the back of a Statistic text we find the critical value of this “F” is 5.32, by looking for a 2-tailed F with 1 and 8 degrees of freedom. The first, or numerator, degrees of freedom are the degrees of freedom associated with the Mean Squared Between (df=1). The second, or denominator, degrees of freedom are associated with the Means Squared Within (df=8). 18 Example 7.1 – Conclusion … Our calculated F = 20 is higher than the critical value, therefore we reject the null hypothesis and conclude that: there is a significant difference in weight gain between the 2 diets. 19 Example 7.1 – Conclusion (cont.) More specifically, we can look at the mean weight gain in each condition (Mpizza = 2 and Mbeer = 4), and conclude that: The beer diet (M = 4.00) has significantly higher weight gain than the pizza diet (M = 2.00), F(1,8) = 20.00, p < .05 (two-tailed). 20 Example 7.1 - Using SPSS First, we need to add 2 variables to the SPSS variable view: • IndependentVariable = diet (coded as 1=Pizza and 2=Beer) • DependentVariable = wtgain (or “weight gain”) As before, personid is added a convenient – although not critical additional variable. 21 Example 7.1 - Using SPSS (cont.) In addition, we must code for the “diet” variable (per above): 22 Example 7.1 - Using SPSS (cont.) 23 Example 7.1 - Using SPSS (cont.) In the same manner as the independent samples t-test, we enter the data in the SPSS data view: 24 Example 7.1 - Using SPSS (cont.) The only “change” in performing the ANOVA procedure is the new syntax: Oneway DependentVariable by IndependentVariable /ranges = scheffe. In our example, the following syntax is entered: 25 Example 7.1 – SPSS output viewer Running this syntax produces the following in the SPSS output viewer: 26 Example 7.1 – SPSS (cont.) A warning is given which states that the subcommand “/ranges = scheffe” was not executed. This procedure is only necessary when there are more than 2 groups, because it helps to test all possible pairs of means between groups. In our example, we can simply interpret the ANOVA table to determine significant difference between our 2 means for Pizza and Beer. The warning can be safely ignored. 27 Example 7.1 – SPSS (cont.) The ANOVA table is simply a reproduction of the table that was computed by hand. Unlike the hand calculated results, SPSS provides an exact probability value associated with the F-value. 28 Example 7.1 – Conclusion The conclusion can therefore be modified as follows: The beer diet (M = 4.00) has significantly higher weight gain than the pizza diet (M = 2.00), F(1,8) = 20.00, p < .01 (twotailed). 29 Example 7.1 – NB: APA style Notice that the probability given by SPSS was p = .002. Per APA style, rounded to 2 significant digits the probability becomes p=.00. Probabilities, however, are never zero, so we must modify this result to the smallest p-value normally expressed in APA style, p < .01. 30 Thus concludes Oneway ANOVA Advanced Research Methods in Psychology - Week 6 lecture - Matthew Rockloff 31