Presentation on theme: "Factorial Analysis of Variance (ANOVA) on SPSS"— Presentation transcript:
1 Factorial Analysis of Variance (ANOVA) on SPSS Practice reproducing the analyses yourself:2 Factor Between (2 levels x 2 levels).sav2 Factor Between (2 levels x3 levels).sav3 Factor Between (2 levels x 2 levels x 2 levels).sav2 Factor Within (2 levels x 2 levels).savAll on Portal
2 Reading- a simple summary of factorial designs- see sections 11 & 12 for between subjects designs and section 13 for within subjects (repeated measures) designs. This is recommended –its concise, clear and to the point. It also contains a very good glossary from which you can quickly refresh your memory for definitions of such things as the Standard Error etc.Chapters 10,11,12 of Gravetter & Forzano cover between, within, and factorial design issues.Chapters 13,14,15 of Gravetter & Wallnau cover the stats – ANOVA etc. However don’t get bogged down with formulas for calculating sums of squares…. See next slide
3 Things you should know: How to interpret interaction plotsHow to interpret ANOVA tables and assumption testsThat the Error degrees of Freedom is always N-1 (N= total number of data points)That the degrees of freedom for a test of a main effect of a factor = number of levels the factor contains -1.That the degrees of freedom for a test of an interaction between two or more factors = the number of levels in one factor x the number of levels in the other x…etc. Thus the DF for a 3 way interaction between factors having 2,2 and 4 factor levels is 1 x 1 x 3=3.That ANOVA uses F tests and that the F statistic for any effect is the Mean Square for the Effect divided by the Error mean Square: MScondition/MSerrorThat when you have an alpha level of .05 this means that the probability of not making a Type 1 error is 95% (.95) for each test you doThus if you have 20 F tests in your ANOVA table the probability of none of them being spurious is .95 x .95 x .95 x .95……or or (1-a)20This actually = .36 or 36% which is why (in complex designs especially) you should stick to examining a few predictions.
4 Things you needn’t worry about: The precise way that Sums of Squares are calculated(But it will help your understanding of ANOVA if you at least understand the gist of how variability is partitioned).How Levene’s test or Mauchly’s test are calculated – only that they test the assumption of homogeneity of variance for between subjects designs and its (more or less equivalent) in within subjects designs.In the SPSS output you can largely ignore the following when doing repeated measures analyses (at this stage at least):The multivariate tests which you get at the beginningTests of within subject contrasts (although these can be a useful tool for examining patterns in the data)Any tests of between subjects effects that only involve an intercept (i.e. you can ignore this output when all your factors are within subjects)
5 1. Between Subjects Designs 2 Factor designsData FormatAll scores in a single columnAdditional columns for each Factor
6 Main assumptions of ANOVA: There are 3 main assumptions underlying ANOVA1. Homogeneity of varianceThe error variance within each condition should be statistically equal. Thus any differences between conditions should only be a shift in the mean. Put another way the effect of treatment/condition manipulations is to add a constant to each individual’s score.
7 Main assumptions of ANOVA: OKs2As2Bs2CmmmmABCCNOT OKmmmCAB
8 Main assumptions of ANOVA: 2. NormalityThe distribution of errors within each condition should be normal. By errors we mean deviations from the mean for that condition.Because the errors are the deviations from the condition means this is equivalent to saying that the scores should be distributed normally about the condition means.
9 Main assumptions of ANOVA: 3.Independence of observationsThe data points should represent independent observations. Knowing the value of one should not tell you anything about the value of any other.N.B. This assumption is obviously violated in repeated measures experiments (because knowing that one data point comes from subject x –who might be a particularly fast responder, say- does tell you something about the likelihood of another observation from subject x being relatively fast). This is why Subjects have to be included as a factor in the analysis of repeated measures designs- the non-independent component is partialled out.
10 DesignExperiment to investigate the effect of stimulus duration and modality (Word vs Picture) on Recognition performance.Dependent Variable (Score)Two Factors: Modality and Duration
11 Factor Levels Modality – two levels Word, Picture Duration – two levels200msec, 800msec= 2 x 2 design
12 Modality Duration Pictures Words 200 ms 5 subjects 5 subjects 800 ms
30 At this point either – Abandon the analysis See if a data transformation removes the problem (e.g. Log(score))Report results but with ‘extreme caution’
31 Assume we have different data: 2 Factor Between (2 levels x 2 levels).savLevene’s test, and any test that checks assumptions for an analysis should not be significant.Here the p value of .271 says that ‘there is no evidence for any differences in variances’ between the groups – which is what we want.
32 ANOVA Table(Ignore shaded items)Test for the Main Effect of Duration (i.e. 200 vs 800 ms pooling across both Modalities)Significant effect of Duration, F(1,16) = 5.5, p = .032
33 There was a significant effect of Stimulus Duration There was a significant effect of Stimulus Duration. Participants who viewed the stimulus for 200 msec scored higher (M =134) than those who viewed it for 800 msec (M = 115), F(1,16) = 5.5, p = .032.
34 Duration Profile PlotThis difference is significant
35 ANOVA Table(Ignore shaded items)Test for the Main Effect of Modality (i.e. Pictures vs Words pooling across both Durations).No Significant effect of Modality.
36 Check the scale! Profile Plot for Modality This difference is not significant
37 Any graphs you present should be using the same scale Any graphs you present should be using the same scale. By default SPSS changes the scale so that the data takes up the whole graph area. Here are the two graphs on the same scale:DurationModality
38 ANOVA Table(Ignore shaded items)Test for the Interaction between Modality and Duration.There was a significant two-way interaction between modality and duration, F(1,16) = 7.2, p = .017.
39 Profile Plot of Modality by Duration interaction
40 Main effect of Duration is still observable in the graph 200 msec Average800 msec Average
42 Main effect of Duration is still observable in the graph 200 msec Average800 msec Average
43 Interpretation of the Modality by Duration Interaction Several ways of describing the interaction:
44 Interpretation of the Modality by Duration Interaction “….At the 200 msec duration pictures resulted in scores approximately 20 points higher than words whereas at the 800 msec duration the opposite pattern was true with words producing scores approximately 20 points below pictures), F (1,16) = 7.2, p = .017.……”
45 Interpretation of the Modality by Duration Interaction “For words there was a small increase in performance going from the 200 msec (M= to the 800 msec duration. With pictures, however, there was a large decrease in performance“
46 Alternative Plot – same data At the 200 msec duration performance was better with pictures (M = 144) than words (M = 124) whereas at the 200 msec duration the opposite was true with words giving better performance (M = 127) than pictures (M = 103), F (1,16) = 7.2, p = .017.
47 Extension to factors with 3 Levels 10 extra participants at 500 msec duration - 5 with Words, 5 with Pictures2 Factor Between (2 levels x 3 levels).sav
48 The analysis is the same, however the interpretation of the main effect of DURATION is a little more complex:Note the increased Degree of Freedom for Duration and the interaction
49 Duration Profile Plot: A significant F test only says that ‘not all the means are equal’
50 To examine individual pair-wise comparisons: If you make a priori predictions about which means you are interested in comparing:You can use Simple T tests (LSD) for 3 meansSidak or Bonferroni for a greater number of comparisons.2. If you want to make post hoc comparisons:You can use Tukey’s Test
53 Note that the more conservative Tukey test only finds one significant difference whereas LSD finds two. Note the Tukey test requires equal sample sizes.
54 There was a significant main effect if stimulus duration, F (2,24) = 8 There was a significant main effect if stimulus duration, F (2,24) = 8.07, p =.02. Post Hoc comparisons using Tukey’s HSD showed that only the difference between the 200 (M = 134.3) and 500 (M = 101.8) durations was significant, p=.001.
55 3 Factor Designs3 Factor Between (2 levels x 2 levels x 2 levels).sav
56 Adding a third ‘Noise’ factor with two levels (Low, High) requires doubling the number of subjects, assuming you still want 5 in each cell. In the following analysis, for ease of interpretation, we will go back to having just two levels of the duration factor (200 vs. 800).
57 Logic of the analysis is the same but we now have: 3 possible main effects :DurationModalityNoise3 possible 2-way interactions:Duration x modalityDuration x noiseModality x noise1 possible 3-way interactionDuration x modality x noise
58 Both main effects of duration and noise significant Both main effects of duration and noise significant. 3-way interaction also significant.
59 Interpreting 3-Way interactions. Much easier if you have some predictions about the expected patternFor instance in this example we might predict that as well as generally decreasing performance high levels of noise might obscure any differences between the picture and word conditions:
60 3-way interaction is a difference in the pattern of a 2-way interaction at levels of the third factor
61 There was a significant 3 way interaction between duration, modality and noise, F (1,32)=4.5, p = In the low noise condition pictures and words produced opposite effects on performance at the two durations. At stimulus presentations of 200msec words gave rise to performance some 20 points lower than pictures whereas the reverse pattern was true for the 800 msec duration. With high noise, however, there was very little evidence of any interaction.
62 If you want to provide a bit more ‘weight’ to your conclusions concerning the interpretation of the 3-way interaction you could perform a simple interaction effects analysis.This is actually very easyYou just run two separate ANOVAs – one at each level of (in this example) the noise factor.Each of these analyses has the factors duration and modality but one uses the data from the high noise condition and the other from the low noise condition.You then interpret the 2-way interactions between duration and modality at each level of noise
63 One ANOVA on this data One ANOVA on this data Can then say whether it is true that the interaction on the left (low noise) is significant whilst the one on the right (high noise) is not.There is one catch – the F ratio for the 2-way interactions in each separate analysis needs to be computed using the MSerror from the original analysis.
64 Original 3 Factor ANOVAMSerror from the original analysis = on 32 DF
65 You now need to run the two separate 2 way ANOVAS on the data from the high and low noise conditions.On SPSS the easiest way to do this is to first split the data using the split data command.
66 Any subsequent commands be they Tables, Plots or, as in this case ANOVAs, will now be done separately for each level of the grouping variable (noise):
67 Analyse / General Linear Model / Univariate Having split the data file by the noise variable you now simply perform a 2 way ANOVA, with factors duration and modality as before:Analyse / General Linear Model / Univariate
68 This factor is left out as it is the one used to split the file SPSS will now compute the two 2 way ANOVAs
69 This table is simply 2 ANOVA tables put together – one for the low noise data and one for the high noise data.
70 However the F ratios are wrong as they need to be computed using the MSerror from the original 3 way ANOVA
71 Original 3 Factor ANOVAMSerror from the original analysis = on 32 DF
72 F ratios are simply the result of dividing the Mean Square for the effect by the error Mean Square (MSerror)E.g. the duration F ratio is simply MSduration / MSerrorFor the simple interaction effects follow up we need to compute our own F ratios for the modality by duration interactions at each noise level by substituting the MSerror from the original analysis.
73 MSerror from the original analysis = 400.8 on 32 DF For the low noise interaction the correct F ratio is / = 5.97For the high noise interaction the correct F ratio is /400.8 = .32
74 For the low noise interaction the correct F ratio is 2393. 978 / 400 For the high noise interaction the correct F ratio is /400.8 = .325.97.32
75 To work out the p value you need either to look it up in F tables. Or to calculate the exact probability (very easlily) using a package such as Excel:
76 E.g. To calculate the p value associated with the low noise modality x duration interaction: The value we got was 5.97This is based on 1 df for the effect and 32 df for errorClick in any cell in Excel and type:=FDIST(5.97,1,32) and press return=FDIST(5.97,1,32)NB. Don’t forget the ‘=‘ at the start of the formulaExcel then gives the answer:The simple interaction effect at the low noise level was significant, F (1,32) = 5.97, p = .02.
77 Repeated Measures designs These are where the same subject is tested in the different experimental conditionsAdvantages are that the test is more sensitiveDisadvantages – things like order effects, practice effects etc.Not always possible in principle –e.g. if partaking in one condition exposes subjects to information that will ‘ruin’ them for any other condition2 Factor Within (2 levels x 2 levels).sav
78 Test is more sensitive because: Individual differences are controlled for:e.g. suppose a reaction time study:Some people are just faster average responders than others. What we are usually interested in is the relative effect of a treatment on performanceRepeated measures (or within subjects) designs examine the relative effect of conditions on individuals
79 Repeated measures ANOVA on SPSS Interpretation of effects from the ANOVA table is the sameMain difference is in the data entryDesigns can be all repeated measures or a mixtureE.g. A two factor repeated measures design could have:Both factors as repeated measures (or within subjects)OrOne repeated measure and one between subjects measure
80 Both factors as repeated measures: Each subject is tested under every combinationThe order of the combinations would normally be randomised for each subjectOrPseudo-randomised so that equal numbers of subjects receive each order (this is the most common method)
81 Modality by Stimulus duration data Assuming this experiment was carried out with both factors as repeated measures:This is how the data is entered into SPSS.Each row represents scores from a single subject.
82 Each subject has 4 data points. These could be single scores or the average of many trials under that condition. The latter is common with measures such as RT which are ‘inherently noisy’ (i.e. you need to take the average of many raw data points to get a good estimate for that subject under those conditions).
83 Give the columns meaningful names – the first column contains data from the Duration level 1 (200msec) and Modality level 1 (picture). You can use short hand for the actual column names and put the longer, more meaningful, description as the variable label:
84 To avoid confusion later the columns should always be ordered in a hierarchy - take a 3 Factor example (all with 2 levels and where F1(1) = Factor 1 Level 1):F3(1)F3(2)F2(1)F2(2)F1(1)F1(2)
86 First Factor is Duration and this has two levels NB – the first factor is the one at the top of the hierarchy:
87 Order in which you define the factors in SPSS 1F3(1)F3(2)F2(1)F2(2)F1(1)F1(2)23
88 Second factor is modality – with two levels This sets up all the factors – now click Define to tell SPSS where the columns are that correspond to each factor level combination
89 The first question mark is asking “where is the column containing the data from level 1 of factor 1 and level 1 of factor 2?” This is our column 1 (d1m1)Note at the top where it says Within-Subjects Variables you get a reminder of which is the first and second factors. The order we defined the factors in was duration then modality hence at the top we have (duration, modality). The numbers in the brackets refer to the levels of the corresponding factors.
90 The process continues until all the within subject variables have been set up. NB: only when you set up the factors in the data sheet according to the hierarchy and define the factors starting from the top of the hierarchy will they be in the correct order already.
91 Once set up you can use the plots and options (display means) in exactly the same way as with between subjects designs.
92 SPSS OutputThis is not quite the same as for between subjects designs.The first box just summarises the within-subjects factors and allows you to check that they have been entered in the right order:
93 You can ignore the multivariate tests output unless you have special reason to question certain assumptions.Mauchly’s Sphericity test is an important assumption test –it is the repeated measures equivalent of Levene’s test for homogeneity of variance. IT SHOULD NOT BE SIGNIFICANT. NB when, as in this case, a factor only has two levels the sphericity cannot be violated and there is never a problem. The dots in the SIG column simply mean that the test is not appropriate.
94 The Tests of Within Subjects Effects are where you find the significance tests for all your within subjects factors and any interactions involving any within subjects factor. Highlighted here is the test for a main effect of Duration.If for any test there is no violation of sphericity use the ‘sphericity assumed’ F and p value.
95 Suppose the test of sphercity for the interaction had given a significant result (p<.05). Then when you came to interpret the interaction effect in the main ANOVA table you would use the Greenhouse-Geiser adjustment:
96 Notice also that in a repeated measures design any within-subjects variable has its own error term and this should be checked when giving the DFs for a test:E.g. …..interaction was significant F (1,19) = ….Here the 1 , as before, comes from the DF associated with the test of the interaction and the 19 comes from the DF associated with the Specific Duration x Modality error term.
97 The Tests of Within-Subjects contrasts only really apply When you have a factor with more than 2 levelsandYou want to test for a particular trend (e.g. that performance increases in a straight line (linear) fashion as drug dosage increases.
98 Plots and tables of means can be interpreted in exactly the same way as between subjects designs.