One-Way Analysis of Variance in SPSS

33
One-Way Analysis of Variance in SPSS Tsagris Michail MSc in Statistics

description

A guide of how to conduct one-way ANOVA in SPSS 19, the parametric and non-parametric way, the Welch and Brown-Forsythe tests.

Transcript of One-Way Analysis of Variance in SPSS

Page 1: One-Way Analysis of Variance in SPSS

One-Way Analysis of

Variance in SPSS

Tsagris Michail

MSc in Statistics

[email protected]

Page 2: One-Way Analysis of Variance in SPSS

2

Page 3: One-Way Analysis of Variance in SPSS

1 Introduction...............................................................................................................3

2 One way Analysis of Variance I...............................................................................4

3 One way Analysis of Variance II...........................................................................12

4 Nonparametric Analysis of Variance (Kruskal-Wallis test)...............................20

5 Analysis of variance for dependent samples Repeated-Measures ANOVA......22

6 Non-parametric analysis of variance for dependent samples.............................26

3

Page 4: One-Way Analysis of Variance in SPSS

1 Introduction

The purpose of these notes is to exhibit the way to perform analysis of variance using SPSS. This means that one has to know what ANOVA is and therefore be willing to perform it using this statistical package. We will also see the Kruskal Wallis test, non-parametric alternative to the one way ANOVA. Furthermore we will see what happens when the samples are not independent, both parametrically and non-parametrically.

Any comments are kindly welcome since they can improve the presentation and the validity of these notes.

2 One way Analysis of Variance I

Let us assume that we have the case where the response time (in seconds) of mice when exposed to a drug is of interest. We gave four different doses (different mgs of the drug) to a sample of mice and recorded their response time to the dose. Each mouse participated once in the experiment. The question of interest is whether the response times differ across the doses. In other words, does the dose affect the response time? The experiment took place under the same conditions for all mice and randomization of the mice within and between the doses is valid. It is obvious that we have more than one observation in each cell (replication) and the response times are independent with each other.

Types of doses

Response Times

1 18 19 14 16 12 182 16 18 16 19 16 163 14 12 10 12 8 104 10 8 12 16 14 12

Table 1: Response times of mice

At first, we will type the data in SPSS Data Editor as follows: Starting from the first row of table 1, we type the data vertically in SPSS. Then we continue with the second row and so on. Next, in a second column next to the first we enter the doses. The types of doses correspond to the factor of interest and the doses are simply the levels of the factor. Therefore, we must enter the levels according to the observations. Since the first row contains the response times for the first dose the second column will start with six consecutive values of 1, (i.e. the first dose), the later six rows will be 2 (i.e. the second dose) and so on. After typing all of the observations, the SPSS Data Editor should look like this:

4

Page 5: One-Way Analysis of Variance in SPSS

Picture 1

The model of Analysis of Variance fitted in the data is the following:

, (1)

where is constant, is the parameter associated with the ith level of the factor and

are the errors, which are assumed to be independent, and follow the The i, j indicators refer to the jth observation of the ith level (or treatment) of the factor.The null and alternative hypotheses are these:

Ηο:

Η : for at least one

We can either select GraphsLegacy Dialogs and then choose Boxplot in order to present a box plot of the data. A scatter plot would fit fine as well but a box plot contains more information about the distributions of the observations within each treatment, along with some limits (the so-called fences) which are helpful in detecting outliers. We will choose the later option and the window of picture 2 will appear on the screen. We select Simple and then Define in order to go to the window of picture 3.

5

Page 6: One-Way Analysis of Variance in SPSS

Picture 2

Picture 3

In this window, we will define the variables in the axes of the box plot. We transfer the variable that contains the response times on the first white box Variable. The variable representing the levels of the factor will be transferred at the white box below the first one (Category Axis). By pressing OK, the result will be the following:

6

Page 7: One-Way Analysis of Variance in SPSS

Plot 1: Box plot of the response times

As you can see, the horizontal axis represents the four treatments (doses) of the factor. The vertical represents the response times. The upper and lower value of each box represents the upper and lower internal fences. The external fences are the ones above and below each box. The horizontal line within each box represents the median of the observations within each treatment. The above figure provides evidence that the first two doses cause greater response times. The mice that were given the other two doses needed less time to response.

The Analysis of Variance to be performed will prove this right. There are two paths to perform one-way Analysis of Variance. The first path is AnalyzeCompare MeansOne-Way ANOVA and the second is AnalyzeGeneral Linear ModelUnivariate. The first way to perform Analysis of Variance does not allow for any predicted values and residuals to be saved. It should be used in cases when the assumption of constant variance across the errors is violated. When this violation occurs then instead of a transformation on the dependent variable (i.e. observations) or use of a non-parametric technique, one could perform the Welch or the Brown-Forsythe test. These tests are robust to deviations from the constant error variance. On the contrary, the first way allows the predicted values and the residuals to be saved but it does not calculate the Welch test. One common element is that post hoc tests are provided in both ways. Tamhane’s test is also available when the variances cannot assumed to be equal. If we try to perform in the first way the window that will appear will look like this:

7

Page 8: One-Way Analysis of Variance in SPSS

Picture 4

We transferred the Response times on the upper white box and the variable indicating the levels of the factor on the right, at the Factor. By clicking on Post Hoc the window of picture 5 appears on the screen.

Picture 5

The tests are categorized with respect to the equality of variances. There are several tests when this assumption is satisfied and different when it is not. When the assumption of equality of variances is not met, the Tamhane’s test is preferred. When this assumption is satisfied we can choose amongst several. The LSD (Fisher’s Least Significance Difference) is a very strong test in detecting pairs of means that differ if applied only when the F test is significant. The disadvantage of this method (and of many more) is that they fail to keep the error rate low. Bonferroni test is a good choice due to its correction suggested by Carlo Emilio Bonferroni. This correction states that if n independent test are to be applied then the α in each test should be equal to 1/n. Tukey’s method is preferable by many statisticians because it control the overall error rate. More information on this issue can be found in any ANOVA book, such as Douglas C. Montgomery’s Design and Analysis of Experiments. If we clink on Options the following window will appear.

8

Page 9: One-Way Analysis of Variance in SPSS

Picture 6

We selected all choices except for the Fixed and random effects. After this is done, select Continue, get back to window of picture 4 and click OK. The results produced by SPSS follow.

Descriptives

Response times

N Mean Std. Deviation Std. Error

95% Confidence Interval for Mean

Minimum MaximumLower Bound Upper Bound

1.00 6 16.1667 2.71416 1.10805 13.3183 19.0150 12.00 19.00

2.00 6 16.8333 1.32916 .54263 15.4385 18.2282 16.00 19.00

3.00 6 11.0000 2.09762 .85635 8.7987 13.2013 8.00 14.00

4.00 6 12.0000 2.82843 1.15470 9.0317 14.9683 8.00 16.00

Total 24 14.0000 3.37510 .68894 12.5748 15.4252 8.00 19.00

Figure 1: Descriptive statistics

Figure 1 contains the descriptive statistics for the response times for each of the four doses. Figure 2 presents the Levene’s test of equality of variances. The significance of the test (p-value) is equal to 0.494. This means that there is evidence to support the hypothesis of equality of variances.

Test of Homogeneity of Variances

Response times

Levene Statistic df1 df2 Sig.

.828 3 20 .494

Figure 2: Levene’s test

The next figure presents the result of the Analysis of Variance. The result of the F test is valid only when the normality assumption and the assumption of equality

9

Page 10: One-Way Analysis of Variance in SPSS

of errors are satisfied. In this case, the assumption of equality of variances is valid. Unfortunately, this way of performing ANOVA does not save the residuals, so we cannot check the normality assumption. The F test is robust to moderate deviations from the normal distribution (and it is usually the case when there are small sample sizes). But still we cannot check if the residuals are not normal or how much do they deviate from the normal distribution. The p-value of the F test is zero; this means that there is evidence to reject the null hypothesis of equality of mean response times across the different doses. The types of doses seem to affect the response time.

ANOVA

Response times

Sum of Squares df Mean Square F Sig.

Between Groups 154.333 3 51.444 9.556 .000

Within Groups 107.667 20 5.383

Total 262.000 23

Figure 3: F test

The next figure contains the results of the Welch and Brown-Forsythe tests. This table should be used when the Levene’s test is significant. This is not the case, therefore not much attention is to be paid (even though the results are the same).

Robust Tests of Equality of Means

Response times

Statistica df1 df2 Sig.

Welch 12.150 3 10.569 .001

Brown-Forsythe 9.556 3 16.472 .001

a. Asymptotically F distributed.

Figure 4: Robust tests

The next figure is the one with the multiple comparisons using the Bonferroni’s and Tamhane’s method. Bonferronis’s method detects more pairs of mean differences to be statistically significant. The only ones pairs of mean response times that are not statistically significant are those corresponding to dose 1 and dose 2 and dose 3 with dose 4. If you take a look at Tamhane’s detected statistically significant pairs, it becomes clear that there are some differences. This is due to the mathematical calculations used in each test. Since this is not the case of unequal variances, we should not consult Tamhane’s method.

10

Page 11: One-Way Analysis of Variance in SPSS

Multiple Comparisons

Dependent Variable:Response times

(I) Types of doses (J) Types of doses

Mean Difference

(I-J) Std. Error Sig.

95% Confidence Interval

Lower Bound Upper Bound

Bonferroni 1.00 2.00 -.66667 1.33957 1.000 -4.5877 3.2544

3.00 5.16667* 1.33957 .006 1.2456 9.0877

4.00 4.16667* 1.33957 .033 .2456 8.0877

2.00 1.00 .66667 1.33957 1.000 -3.2544 4.5877

3.00 5.83333* 1.33957 .002 1.9123 9.7544

4.00 4.83333* 1.33957 .011 .9123 8.7544

3.00 1.00 -5.16667* 1.33957 .006 -9.0877 -1.2456

2.00 -5.83333* 1.33957 .002 -9.7544 -1.9123

4.00 -1.00000 1.33957 1.000 -4.9211 2.9211

4.00 1.00 -4.16667* 1.33957 .033 -8.0877 -.2456

2.00 -4.83333* 1.33957 .011 -8.7544 -.9123

3.00 1.00000 1.33957 1.000 -2.9211 4.9211

Tamhane 1.00 2.00 -.66667 1.23378 .996 -5.0748 3.7415

3.00 5.16667* 1.40040 .028 .5267 9.8066

4.00 4.16667 1.60035 .148 -1.0594 9.3927

2.00 1.00 .66667 1.23378 .996 -3.7415 5.0748

3.00 5.83333* 1.01379 .002 2.3780 9.2887

4.00 4.83333* 1.27584 .039 .2393 9.4273

3.00 1.00 -5.16667* 1.40040 .028 -9.8066 -.5267

2.00 -5.83333* 1.01379 .002 -9.2887 -2.3780

4.00 -1.00000 1.43759 .985 -5.7866 3.7866

4.00 1.00 -4.16667 1.60035 .148 -9.3927 1.0594

2.00 -4.83333* 1.27584 .039 -9.4273 -.2393

3.00 1.00000 1.43759 .985 -3.7866 5.7866

*. The mean difference is significant at the 0.05 level.

Figure 5: Multiple comparisons

Plot 2 is the mean response times plot for each dose. The means for each dose are represented with the small circles, then a line connects this points. It is obvious again as before that; some doses have different response times. It is clearer in this plot that doses 1 and 2 do not differ much and doses 3 and 4 do not differ much either. Multiple comparisons have already proved this right. As already mentioned via this way, we can only check the assumption of equal error variances. The error normality assumption cannot be checked, simply because the residuals are not calculated. The second (and most popular) way that we will show allows all assumptions to be checked. It does not generate the results of any Welch or Brown-Forshythe tests but it

11

Page 12: One-Way Analysis of Variance in SPSS

does have an option in multiple comparisons for the case when the assumption of equality of error variances is violated.

Plot 2: Means plot

3 One way Analysis of Variance II

The (popular) way to perform ANOVA is through AnalyzeGeneral Linear ModelUnivariate and the window of picture 7 shall appear on the screen. The white boxes at which we transferred the variables are the same as before.

Picture 7

12

Page 13: One-Way Analysis of Variance in SPSS

It is obvious now that the first way was the simplest and the less informative. It should be used only when the assumption of the variances is violated (and we cannot “lock” the variances using a transformation). The means plot can be extracted from the Plots selection, where the window of picture 8 will appear. We transferred the factor variable on the Horizontal Axis white box and then we must press the button Add. If you do not click on the Add button, the message of picture 9 will appear on the screen warning you that you have not pressed it. We press Continue to return to the main window, that of picture 7 (the Means Plot is the same as before, therefore we do not show it). The window of picture 10 is the same as in picture 5. It is appeared through the Post Hoc option. We only selected Tukey’s test this time.

Picture 8

Picture 9

13

Page 14: One-Way Analysis of Variance in SPSS

Picture 10

By clicking the Save option from window of picture 7 we can chose to save the residuals and the predicted values of the model. The window of picture 11 is the following and as you can see, we selected the unstandardized values:

Picture 11

If we click on the Options, the window of picture 12 will appear. We need not transfer the (OVERALL) and Doses on the right white box, because if we want to display the means for the response times for each dose and the overall mean response time we can simply select the Descriptive statistics. We will also select the

14

Page 15: One-Way Analysis of Variance in SPSS

Parameter estimates, the Homogeneity tests (Levene’s test for the equality of variances) and the Residual plot. We press Continue, return to window of picture 7, then press OK and the results are shown under picture 12.

Picture 12

The first table contains information about the sample sizes within each dose. The following table displays the means, the standard deviations and the sample sizes for the response times within each dose. The next table is the Levene’s test also shown in figure 2. This is a more informative table since it shows a text of the hypothesis that it tests.

Descriptive Statistics

Dependent Variable:Response times

Types of doses Mean Std. Deviation N

1.00 16.1667 2.71416 6

2.00 16.8333 1.32916 6

3.00 11.0000 2.09762 6

4.00 12.0000 2.82843 6

Total 14.0000 3.37510 24

Figure 6: Descriptive statistics

15

Page 16: One-Way Analysis of Variance in SPSS

Levene's Test of Equality of Error Variancesa

Dependent Variable:Response times

F df1 df2 Sig.

.828 3 20 .494

Tests the null hypothesis that the error variance

of the dependent variable is equal across groups.

a. Design: Intercept + Doses

Figure 7: Levene’s test

The next figure is of most interest since it is the result of the F test. We only look at the significance referring to the doses (which is equal to zero). The note under the table gives extra information about the correlation of prediction for this model (58.9% of the variance of the data is explained via this Analysis of Variance model). The conclusion is that there is evidence to reject the null hypothesis stated in page 4. Therefore, the mean response times for at least one pair of doses (if not all) differs statistically significant at a level of significance equal to 0.05 (i.e. α=0.05). We can also state that there is evidence that the type of doses affects the response time of the mice.

Tests of Between-Subjects Effects

Dependent Variable:Response times

Source

Type III Sum of

Squares df Mean Square F Sig.

Corrected Model 154.333a 3 51.444 9.556 .000

Intercept 4704.000 1 4704.000 873.808 .000

Doses 154.333 3 51.444 9.556 .000

Error 107.667 20 5.383

Total 4966.000 24

Corrected Total 262.000 23

a. R Squared = .589 (Adjusted R Squared = .527)

Figure 8: ANOVA results

The next figure shown contains information on the estimated parameters of the model (1). We see that the parameter of dose 4 is equal to zero. This is done by SPSS and it is a restriction on the estimated parameters of the model. This type of constrain is known as “corner point constrain” or “corner point parameterization”. We see that the intercept is se to 12. The interpretation of these parameters is that when the dose 4 is given to mice the expected mean response time is equal to 12. The expected mean response time is decreased by one second (in comparison to dose 4) when mice are exposed to dose 3. The expected mean response times of the mice when exposed to doses 1 and 2 are by 4.167 and 4.83 seconds higher respectively. Using mathematics, we have that

and

16

Page 17: One-Way Analysis of Variance in SPSS

If we look at figure 6, we will see the same numbers.

Parameter Estimates

Dependent Variable:Response times

Parameter B Std. Error t Sig.

95% Confidence Interval

Lower Bound Upper Bound

Intercept 12.000 .947 12.669 .000 10.024 13.976

[Doses=1.00] 4.167 1.340 3.110 .006 1.372 6.961

[Doses=2.00] 4.833 1.340 3.608 .002 2.039 7.628

[Doses=3.00] -1.000 1.340 -.747 .464 -3.794 1.794

[Doses=4.00] 0a . . . . .

a. This parameter is set to zero because it is redundant.

Figure 9: Parameter estimates

The next figure shows the multiple comparisons using the Tukey method.

Multiple Comparisons

Response times

Tukey HSD

(I) Types of doses (J) Types of doses

Mean Difference

(I-J) Std. Error Sig.

95% Confidence Interval

Lower Bound Upper Bound

1.00 2.00 -.6667 1.33957 .959 -4.4160 3.0827

3.00 5.1667* 1.33957 .005 1.4173 8.9160

4.00 4.1667* 1.33957 .026 .4173 7.9160

2.00 1.00 .6667 1.33957 .959 -3.0827 4.4160

3.00 5.8333* 1.33957 .002 2.0840 9.5827

4.00 4.8333* 1.33957 .009 1.0840 8.5827

3.00 1.00 -5.1667* 1.33957 .005 -8.9160 -1.4173

2.00 -5.8333* 1.33957 .002 -9.5827 -2.0840

4.00 -1.0000 1.33957 .877 -4.7494 2.7494

4.00 1.00 -4.1667* 1.33957 .026 -7.9160 -.4173

2.00 -4.8333* 1.33957 .009 -8.5827 -1.0840

3.00 1.0000 1.33957 .877 -2.7494 4.7494

Based on observed means.

The error term is Mean Square(Error) = 5.383.

*. The mean difference is significant at the .05 level.

Figure 10: Multiple comparisons

Finally, the Residual plot selected from window of picture 12 is shown overleaf. There are six plots in which the axes are the observed and predicted values and the residuals. The six plots are actually three, since the other three are simply the

17

Page 18: One-Way Analysis of Variance in SPSS

first three with the values in the axes exchanged. From the plot of standardized residuals versus observed values we can see the linear relationship between the types of doses and the response times. From the plot of standardized residuals versus predicted values we can graphically see that the error variances are equal across the treatments (or doses).

Plot 3: Residual plot

The reason for which we saved the predicted values along with the residuals was to produce the plot of these two. Needless to do so now, since it is already provided. The residuals on the other hand will be used to check the normality assumption. To do so, go to Analyze→Nonparametric Tests→Legacy Dialogs→1-Sample K-S and the window of picture 13 will appear on the screen. We transferred only the residuals on the right white box. If we click on Exact the window of picture 14 will appear.

18

Page 19: One-Way Analysis of Variance in SPSS

Picture 13

Picture 14

By doing so, we choose to generate the results of the Monte Carlo test as well. The 1 sample Kolmogorov Smirnov test is asymptotically correct, whereas the Monte Carlo test is based on 10000 tests (by default) executed and provides more accurate results. The result of these two methods is shown below in figure 11.

19

Page 20: One-Way Analysis of Variance in SPSS

One-Sample Kolmogorov-Smirnov Test

Residual for

Times

N 24

Normal Parametersa,b Mean .0000

Std. Deviation 2.16360

Most Extreme Differences Absolute .114

Positive .108

Negative -.114

Kolmogorov-Smirnov Z .557

Asymp. Sig. (2-tailed) .916

Monte Carlo Sig. (2-tailed) Sig. .883c

99% Confidence Interval Lower Bound .874

Upper Bound .891

a. Test distribution is Normal.

b. Calculated from data.

c. Based on 10000 sampled tables with starting seed 2000000.

Figure 11: Kolmogorov Smirnov test

The null hypothesis tested via this test is that the residuals follow the normal distribution versus the alternative that they do not. The asymptotic significance (p-value) of the Kolmogorov Smirnov test is equal to 0.916, whereas the significance based upon the Monte Carlo simulations is equal to 0.883 with a 99% confidence interval of (0.874 , 0.891). The conclusion is obvious; there is evidence to support the normality assumption of the residuals.

4 Nonparametric Analysis of Variance (Kruskal-Wallis test)

In order to perform Analysis of Variance, certain assumptions must be satisfied. These are independency and normality of the residuals and equality of the error variances. We saw a way to deal with the violation of the equality of the variances. Theory states that the F-test is robust to slight deviations from the normal distribution. This is the case in small sample sizes where small deviations from the normal distribution are reasonable to occur. If we cannot assume normality of the residuals then nonparametric techniques have to be used instead of the Analysis of Variance (parametric) technique. This technique is called Kruskal-Wallis test and it uses the ranks of the observations. This nonparametric alternative is easier to conduct in SPSS as it needs no assumptions to be satisfied. The way to this in SPSS is the following: Analyze→Nonparametric→Tests→Legacy Dialogs→K Independent Samples and the window of picture 15 shall appear.

20

Page 21: One-Way Analysis of Variance in SPSS

Picture 15

We transferred the dependent variable (response time) on the right white box (Test Variable List) and the factor (Doses) to the white box below (Grouping Variable). There is a selection option (Define Range) below this white box. We click on it and the window of picture 16 will appear. We have four different types of doses coded as 1 through 4. As you can see from the picture below, we typed 1 in the Minimum and 4 in the Maximum. If we did not do this, SPSS would not provide any results because it would not “know” which are the categories whose treatments means are to be compared. By pressing Continue we return to the main window of picture 15. If we select Exact, we can choose to conduct the Monte Carlo test. The results generated for the same data follow overleaf.

Picture 16

21

Page 22: One-Way Analysis of Variance in SPSS

Test Statisticsb,c

Response times

Chi-Square 13.816

Df 3

Asymp. Sig. .003

Monte Carlo Sig. Sig. .000a

99% Confidence Interval Lower Bound .000

Upper Bound .001

a. Based on 10000 sampled tables with starting seed 299883525.

b. Kruskal Wallis Test

c. Grouping Variable: Types of doses

Figure 12: Non parametric analysis of variance

Comparing the p-value obtained by the non-parametric test with the p-value generated by the parametric test, we see that the results are the same. There is evidence to reject the null hypothesis that the response times are equal for all types of doses. The alternative test to the multiple comparisons techniques is the Mann-Whitney test for two independent samples. This is actually the alternative of the two samples t-test. The Bonferroni adjustment must be done in order to obtain the new alpha (divide the usual 0.05 by the number of tests necessary to be executed).

5 Analysis of variance for dependent samples Repeated-Measures ANOVA

We will now see how to approach the same problem seen before but with a major difference. We allow the samples to be dependent. For instance, like in the following example we measure the sales of some products in a particular market along 4 weeks. The data used are testmaket.sav from the SPSS database. The data have this format and we will transfer them to SPSS as they are:

No Week1 Week2 Week3 Week41 18 14 12 62 19 12 8 43 14 10 6 24 16 12 10 45 12 8 6 26 18 10 5 17 16 10 8 48 18 8 4 19 16 12 6 210 19 16 10 811 16 14 10 912 16 12 8 8

Table 2: Sales measures over a 4 week-period

22

Page 23: One-Way Analysis of Variance in SPSS

The goal is to see if the means of the measurements along the 4 weeks are the same or not. The conduction of the hypothesis testing in SPSS is as follows: Analyze→General Linear Model→Repeated Measures and the window of picture 17 will appear. We filled the upper white box (Within-Subject Factor Name:) with a name, it is the factor. In the box below it (Number of Levels:) we put the number of the repeated measures, in our case, we have measures from 4 weeks. The box Measure Name: can be filled in by the name of the measures. In our case that is sales.

Picture 17

Clicking on Add and then Define we will go to the window of picture 18. In the window of picture 18 we will transfer the four columns onto the right white box. By selecting Plots… we can ask for plot of means. Options… produces the the window as in picture 12. There we can choose descriptive statistics to appear. If we click on Save… we can save the residuals (than can be used for the normality assumptions checking) and the estimated values. We can press now OK and the following results will appear.

23

Page 24: One-Way Analysis of Variance in SPSS

Picture 18

The sphericity test checks an assumption regarding the variances of the residuals, but not the equality across the repeated samples. We want the p-value of this test to be more than 0.05, in other word we do not want this assumption to be rejected. In our case the p-value (Sig.) is equal to 0.112.

The table in figure 13 contains 4 different hypothesis test statistics for the same purpose. The first one assumes that the sphericity assumption is satisfied. We are in this case now. If Mauchly’s test of sphericity rejects this assumption then we can use the other 3 tests.

Mauchly's Test of Sphericityb

Measure: sales

Within Subjects Effect Mauchly's W

Approx. Chi-

Square Df Sig.

Epsilona

Greenhouse-

Geisser Huynh-Feldt Lower-bound

Week .398 8.957 5 .112 .622 .744 .333

Tests the null hypothesis that the error covariance matrix of the orthonormalized transformed dependent variables is proportional to an

identity matrix.

a. May be used to adjust the degrees of freedom for the averaged tests of significance. Corrected tests are displayed in the Tests of

Within-Subjects Effects table.

b. Design: Intercept

Within Subjects Design: week

Figure 13: Mauchly’s test of sphericity

24

Page 25: One-Way Analysis of Variance in SPSS

Tests of Within-Subjects Effects

Measure: sales

Source

Type III Sum of

Squares df Mean Square F Sig.

Week Sphericity Assumed 991.500 3 330.500 127.561 .000

Greenhouse-Geisser 991.500 1.865 531.709 127.561 .000

Huynh-Feldt 991.500 2.231 444.504 127.561 .000

Lower-bound 991.500 1.000 991.500 127.561 .000

Error(week) Sphericity Assumed 85.500 33 2.591

Greenhouse-Geisser 85.500 20.512 4.168

Huynh-Feldt 85.500 24.536 3.485

Lower-bound 85.500 11.000 7.773

Figure 14: Tests for the equality of the means

We can see from the above table that the assumption of the equality of the means is rejected at a 5% level of significance. This means that one or more means differ. To detect the pairs which are significantly different we can perform many paired t-tests. If we repeat the same procedure we described before and in the window of picture 18 select Options… this will take us to the window of picture 19 (which is the same as that in picture 12).

Picture 19

25

Page 26: One-Way Analysis of Variance in SPSS

We will transfer the factor on the right box and underneath of it we will click on Compare main effects and below we will select Bonferroni. The Bonferroni correction will attain the overall type I error at the 5% level for all tests. The results are given in the following table.

Pairwise Comparisons

Measure:sales

(I) week (J) week

Mean Difference

(I-J) Std. Error Sig.a

95% Confidence Interval for

Differencea

Lower Bound Upper Bound

1 2 5.000* .663 .000 2.873 7.127

3 8.750* .799 .000 6.187 11.313

4 12.250* .906 .000 9.345 15.155

2 1 -5.000* .663 .000 -7.127 -2.873

3 3.750* .429 .000 2.375 5.125

4 7.250* .494 .000 5.664 8.836

3 1 -8.750* .799 .000 -11.313 -6.187

2 -3.750* .429 .000 -5.125 -2.375

4 3.500* .515 .000 1.848 5.152

4 1 -12.250* .906 .000 -15.155 -9.345

2 -7.250* .494 .000 -8.836 -5.664

3 -3.500* .515 .000 -5.152 -1.848

Based on estimated marginal means

*. The mean difference is significant at the .05 level.

a. Adjustment for multiple comparisons: Bonferroni.

Figure 15: Multiple hypothesis tests

6 Non-parametric analysis of variance for dependent samples

We will now show how to perform the same test as before but using non-parametric statistics this time. This test like most of non-parametric statistics refers to the medians and not the means of the dependent groups. It is however more simple and easier to conduct. We choose Analyze→Nonparametric Tests→Legacy Dialogs→K Related samples and the window of picture 20 shall appear on the screen. We will transfer the four columns again on the right white box. By pressing Exact… we can ask for the p-value to be calculated through Monte-Carlo as well. The results appear in figure 16.

26

Page 27: One-Way Analysis of Variance in SPSS

Picture 20

Test Statisticsa

N 12

Chi-Square 12.000

Df 1

Asymp. Sig. .001

Monte Carlo Sig. Sig. .000

99% Confidence Interval Lower Bound .000

Upper Bound .001

a. Friedman Test

Figure 16: Friedman test

The conclusion is the same as before, we have evidence to say that the medians of the sales are not the same across the four weeks at α=5%.

27