
Research Question
How to lose weight effectively? Do diets really work and what about exercise? In order to find out, 180 participants were assigned to one of 3 diets and one of 3 exercise levels. After two months, participants were asked how many kilos they had lost. These data -partly shown above- are in weightloss.sav.
We’re going to test if the means for weight loss after two months are the same for diet, exercise level and each combination of a diet with an exercise level. That is, we’ll compare more than two means so we end up with some kind of ANOVA.
Case Count and Histogram
We always want to have a basic idea what our data look like before jumping into any analyses. We first want to confirm that we really do have 180 cases. Next, we’d like to inspect the frequency distribution for weight loss with a histogram. We’ll do so by running the syntax below.
show n.*Inspect histogram for weight loss.
frequencies wloss
/format notable /*= don’t create table because it’s too large.
/histogram.
Result
Contingency Table Diet by Exercise
We now like to know how participants are distributed over diet and exercise. For our ANOVA, later on, we need to know if our design is balanced: are the percentages of participants in each diet equal over exercise levels? Some of you may notice that this question is actually the null hypothesis in a chi-square test. And that’s exactly what we’ll run next.
crosstabs diet by exercise
/statistics chisq.
Result
Means Table
So did the diet and exercise have any effect? A very simple way for getting an idea of this is running a basic MEANS table.
means wloss by diet by exercise.
Result
It may take a minute to see the pattern in this table but I did my best to highlight it with colors. Note that participants without any diet -all exercise levels taken together- lost an average of 2.8 kilos. The Atkins and vegetarian diets resulted in 6.3 and 4.3 kilos of weight loss on average. This is the main effect for diet: the differences in weight loss attributable to diet while taking together all exercise levels. In a similar vein, we see a somewhat stronger main effect for exercise with means running from 2.3 up to 8.6 kilos.
An interesting question is whether the effect of exercise depends on the diet followed. This is what we call an interaction effect. We’ll explain it in a minute by visualizing our means in a chart.
Two Way ANOVA – Basic Idea
We just saw that different diets and exercise levels show different mean weight losses. However, we’re looking at just a tiny sample. The situation in the (much larger) population may be different. Is it credible that we find these differences if neither diet nor exercise has any effect whatsoever in our population? We’ll answer this question by running a two way ANOVA.
ANOVA Assumptions
In short, the main statistical assumptions required for ANOVA are
- independent observations: this often means that each case (row of data values) must represent a separate person (or other “object”). It’s not allowed for a single person to appear as more than one case, which holds for our data.
- homoscedasticity: the standard deviation of our dependent variable (weight loss) must be equal for each (diet/exercise) group of respondents. Our previous means table shows that they are pretty similar indeed. Nevertheless, we’ll also test this assumption more formally with Levene’s test which is included in SPSS ANOVA procedure.
- a normally distributed dependent variable in the population. Our previous histogram suggests this holds for our data. On top of that, the normality assumption is of minor importance for larger sample sizes due to the central limit theorem.
SPSS Two Way ANOVA Menu
SPSS Two Way ANOVA Syntax
Following through all steps results in the syntax below. We’ll run it and discuss the results.
UNIANOVA wloss BY diet exercise
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/POSTHOC=diet exercise (TUKEY)
/PLOT=PROFILE(exercise*diet)
/PRINT=ETASQ HOMOGENEITY
/CRITERIA=ALPHA(.05)
/DESIGN=diet exercise diet*exercise.
Two Way ANOVA Output – Levene’s Test
Two Way ANOVA Output – Profile Plots
So what about our interaction effect? Well, the effect of exercise is visualized as a line for each diet group separately. Since these lines look pretty similar, our plot doesn’t show much of an interaction effect.
However, we’ll try to confirm this with a more formal test in a minute. Technical note: the “estimated marginal means” are equal to the observed means in our previous means table because we tested the saturated model (consisting of all main and interaction effects as this is the default setting in UNIANOVA).
Two Way ANOVA Output – Between Subjects Effects
Our means plot was very useful for describing the pattern of means resulting from diet and exercise in our sample. But perhaps things are different in the larger population. If neither diet nor exercise affect weight loss, could we find these sample results by mere sampling fluctuation? Short answer: no.
Two Way ANOVA Output – Multiple Comparisons
We now know that the average weight loss is not equal for all different diets and exercise levels. So precisely which means are different? We can figure that out with post hoc tests, the most common of which is Tukey’s HSD, the output of which is shown below.
A similar table for diet appears in the output but we’ll leave it as an exercise to the reader to interpret it.
So that’s about it. I hope you were able to follow the lines of thought in this tutorial and that they make some sense to you.
