Presentation is loading. Please wait.

Presentation is loading. Please wait.

Two-Way Analysis of Variance STAT E-150 Statistical Methods.

Similar presentations


Presentation on theme: "Two-Way Analysis of Variance STAT E-150 Statistical Methods."— Presentation transcript:

1 Two-Way Analysis of Variance STAT E-150 Statistical Methods

2 2 One-way ANOVA analyzes the relationship between two variables, a quantitative response variable and the groups that are categories of a factor. In a two-way ANOVA model, there are two factors, each with its own number of levels. The two-way ANOVA tests to see if the factors are significant, either separately (called the main effects) or in combination (via an interaction).

3 3 In a one-way ANOVA, we test for the equality of the means of several levels of a variable, by comparing the variation between the levels and the variation within each level (or group, or treatment.) In two-way ANOVA the total variance is again partitioned into separate components. One is the variation within the groups. But in this case the between-groups variability is further divided into the variability due to Factor A, the variability due to Factor B, and the variability due to the interaction between the factors.

4 4 The assumptions for this test are: Independence Assumption The groups must be independent of each other, and the subjects within each group must be randomly assigned Equal Variance Assumption The variances of the treatment groups are equal Normal Population Assumption The values for each treatment group are normally distributed

5 5 Example: Suppose we are interested in analyzing the effect of gender and age on income. We will treat the ages as categories: ages 18 - 29, 30 - 39, 40 - 49, and 50 or higher. This is the structure of this design: Gender FemaleMale Age category 18 - 29 Income for n subjects Female, 18-29 Income for n subjects Male, 18-29 30 - 39 Income for n subjects Female, 30-39 Income for n subjects Male, 30-39 40 - 49 Income for n subjects Female, 40-49 Income for n subjects Male, 40-49 ≥ 50 Income for n subjects Female, ≥ 50 Income for n subjects Male, ≥ 50

6 6 We can then address these questions: - Are there significant mean differences for income between male and female employees? - Are there significant mean differences for income by age category among employees? - Is there a significant interaction on income between gender and age category?

7 7 The hypotheses are: H 0 : μ F1 = μ F2 = μ F3 = μ M1 = μ M2 = μ M3 (1, 2, and 3 refer to the age groups) H a : the means are not all equal

8 8 The first step is to determine whether there is interaction between the two factors, age and gender, by creating an interaction plot. If the lines intersect suggest that there is factor interaction. However, it is important to check the ANOVA results to see if any interaction is significant. Here is the interaction plot for our example: Since there is no intersection, we can conclude that there is no interaction between gender and age.

9 9 The next step is to check the Equal Variances assumption: Tests the null hypothesis that the error variance of the dependent variable is equal across groups. a. Design: Intercept + agecat4 + sex + agecat4 * sex Since p is large, the null hypothesis of equal variances is not rejected; we can conclude that the data does not violate the Equal Variances assumption. Levene's Test of Equality of Error Variances a Dependent Variable:rincom2 Fdf1df2Sig. 1.0617701.387

10 10 Finally, here are the results of the ANOVA test: A two-way ANOVA consists of three separate hypothesis tests, for - the mean difference between levels of the first factor - the mean difference between levels of the second factor - any other mean differences that may result from the combination of the factors Tests of Between-Subjects Effects Dependent Variable:rincom2 Source Type III Sum of SquaresdfMean SquareFSig. Corrected Model2236.798 a 7319.54315.360.000 Intercept121426.9541 5836.953.000 agecat41350.5163450.17221.640.000 sex842.0731 40.478.000 agecat4 * sex60.316320.105.966.408 Error14583.00270120.803 Total149966.000709 Corrected Total16819.800708 a. R Squared =.133 (Adjusted R Squared =.124)

11 11 The first two are tests for the main effects. The null hypothesis is always that there are no differences between the levels of the factor. Example: H 0 : μ M - μ F = 0 The third test is the test for interaction; the null hypothesis is that there is no interaction between the factors. Tests of Between-Subjects Effects Dependent Variable:rincom2 Source Type III Sum of SquaresdfMean SquareFSig. Corrected Model2236.798 a 7319.54315.360.000 Intercept121426.9541 5836.953.000 agecat41350.5163450.17221.640.000 sex842.0731 40.478.000 agecat4 * sex60.316320.105.966.408 Error14583.00270120.803 Total149966.000709 Corrected Total16819.800708 a. R Squared =.133 (Adjusted R Squared =.124)

12 12 It is important to note that these tests are independent; the outcome of one test does not affect the outcome of any other test. Therefore, it is possible to have any combination of significant and nonsignificant main effects and interactions.

13 13 What do these results show? We can see that the two categories Age and Sex are significant; however the interaction is not, as the interaction graph suggested. And so we have two significant main effects and an insignificant interaction. Tests of Between-Subjects Effects Dependent Variable:rincom2 Source Type III Sum of SquaresdfMean SquareFSig. Corrected Model2236.798 a 7319.54315.360.000 Intercept121426.9541 5836.953.000 agecat41350.5163450.17221.640.000 sex842.0731 40.478.000 agecat4 * sex60.316320.105.966.408 Error14583.00270120.803 Total149966.000709 Corrected Total16819.800708 a. R Squared =.133 (Adjusted R Squared =.124)

14 14 To investigate which groups are different, we can conduct a Scheffe post hoc test to compare all group combinations and identify any significant pairs. Here are the results of this test: We can see that the age category 18 - 29 differs significantly in income from all other age categories. In addition, those 30 - 39 are significantly different in income from those 40 - 49 years of age. Multiple Comparisons rincom2 Scheffe (I) 4 categories of age(J) 4 categories of age Mean Difference (I-J)Std. ErrorSig. 95% Confidence Interval Lower BoundUpper Bound 18-2930-39-2.1172 *.49334.000-3.4997-.7348 40-49-3.9165 *.51013.000-5.3461-2.4870 50+-3.2930 *.54550.000-4.8216-1.7643 30-3918-292.1172 *.49334.000.73483.4997 40-49-1.7993 *.44207.001-3.0381-.5605 50+-1.1757.48245.116-2.5277.1762 40-4918-293.9165 *.51013.0002.48705.3461 30-391.7993 *.44207.001.56053.0381 50+.6235.49961.669-.77652.0236 50+18-293.2930 *.54550.0001.76434.8216 30-391.1757.48245.116-.17622.5277 40-49-.6235.49961.669-2.0236.7765 Based on observed means. The error term is Mean Square(Error) = 20.803. *. The mean difference is significant at the.05 level.

15 15 How do you report the results? The two-way analysis of variance was conducted to investigate income differences in gender and age categories among employees. The results show a significant main effect for gender (F = 40.48, p <.001) and age category (F = 21.64, p <.001). Interaction between the factors was not significant (F =.966, p =.408). The Scheffe post-hoc test revealed that the age category of 18-29 differed significantly in income from the other age categories. In addition, the income for those employees 30-39 years of age differed significantly from those 40-49 years of age.

16 16 SPSS Instructions for Two-Way ANOVA To create an interaction plot: Choose > Graphs > Chart Builder Choose Line and drag the second graph (Multiple) to the preview area. Select the response variable and move it to the y-axis. Select one predictor and move it to the x-axis. Select the other predictor and move it to the Set Color area. Click OK.

17 17 To perform a Two-Way Analysis of Variance Choose > Analyze > General Linear Model > Univariate Identify the response variable and move it to the Dependent Variable list. Select the variables that define the groups and move them into the Fixed Factors box.

18 18 Then click on Options, and under Display, select Descriptive statistics and Homogeneity tests. Click on Continue and then OK. Also click on Save and save the unstandardized predicted values and residuals: Group 1

19 19 Then click on Options, and under Display, select Descriptive statistics and Homogeneity tests. Click on Continue and then OK. Also click on Save and save the unstandardized predicted values and residuals: Group 1

20 20 You will then see the results for Levene's Test and the Tests of Between- Subjects Effects. The predicted values and residuals will be saved in your data sheet as PRE_1 and RES_1. In the Univariate dialog box, you can also choose Post-hoc… and then in the next dialog box, choose the Scheffe post hoc test. This will produce the Multiple Comparisons table.

21 21 Note that this analysis can also be used for a One-Way ANOVA so that the residuals and predicted values can be saved. Using the data for the Anorexia study, once these two values are saved, the residuals can be graphed.

22 22 Use > Analyze > Descriptive Statistics > Explore and choose the residuals as the dependent variable. Then choose Plots and select Histogram and Normality Plots with tests. Then click on Continue and OK.

23 23 The results include the following graphs of the residuals:


Download ppt "Two-Way Analysis of Variance STAT E-150 Statistical Methods."

Similar presentations


Ads by Google