# How can I use XLSTAT to run a repeated measures ANOVA?

An Excel sheet with both the data and the results can be downloaded by clicking here. The data correspond to an experiment in which a treatment for depression is studied. Two groups of patients (1: control / 2: treatment) have been followed at five different times (0: pre-test, 1: one month post-test, 3: 3 months follow-up and 6: 6 months follow-up). The dependant variable is a depression score.

We have performed a repeated measures ANOVA in order to determine the effect of the treatment and the effect of time on the depression score. The repeated measures ANOVA model is the same as the classical ANOVA model with interactions:

We have two fixed factors (time and group) and one interaction factor (time*group). The difference between classical ANOVA and repeated measures ANOVA is that measures on the same patient at different times are not supposed to be independent and, thus, the covariance matrix of e is not diagonal.

XLSTAT uses the mixed models theory to treat repeated measures ANOVA and this raises some differences. Some supplementary options are available like the choice between many covariance structures for the covariance matrix of the error term. Throughout this tutorial we will use the compound symmetry structure. Please consult the XLSTAT help for more details on covariance structures.

Data structure:

Data should have a particular shape when using the mixed model methodology for repeated measures ANOVA. All the measures have to be on the same column with:

- a factor called repeated factor which indicates what repetition is associated to this measure

- a factor called subject factor which indicates what subject is associated to this measure.

In our example, each patient will appear in 4 different lines. The data has to be in the following form:

If your data is in a different form, one column for each measure, you should transform it in order to obtain the preceding structure.

After opening XLSTAT, select the XLSTAT/Modeling data/Repeated measures ANOVA command, or click on the corresponding button of the "Modeling data" toolbar (see below).

Once you've clicked on the button, the repeated measures ANOVA dialog box appears. Select the data on the Excel sheet. The "Dependent variable" (or variable to model) is here the "dv". Our aim is to determine the effect of the group, the time and the interaction between the two on the variability of the depression score. As we selected the column title for the variables, we left the option "Variable labels" activated. Repeated and subject factors must be selected as explanatory variables.

The "interactions" option is activated on the options tab, and the maximum level of interaction is set to 2. We left the constraint option at "a1=0", meaning that we want the model to be built on the assumption that the control group has the standard effect on the score. Although you have to apply a constraint to the model in ANOVA for theoretical reasons, it will not affect the results (goodness of fit). The only difference it makes is in the actual writing of the model.

The covariance structure selected is the default one which is compound symmetry.

The selected outputs are:

Once you have clicked on the "OK" button, a dialog box is displayed so that you can choose which factors have to be taken into account in the model. The fixed effects are time, group and time*group, the repeated factor is time and the subject factor is subj.

Note: A factor cannot be the subject factor and a fixed effect at he same time. Repeated and subject factors have to be different and both qualitative.

Once you have clicked on the “Ok” button, the computation starts. The results will then be displayed.

## Interpreting the results of a repeated measures ANOVA

The first results displayed by XLSTAT are the basic statistics associated to the dependent variable.

For each measure, an ANOVA is performed. Results associated to time 0, 1, 3 and 6 are displayed. For more details, you can see the following tutorial on one-way ANOVA.

The analysis of variance table pre-test (dv0) is:

The analysis of variance table one month post-test (dv1) is:

The analysis of variance table 3 months follow-up (dv3) is:

The analysis of variance table 6 months follow-up (dv0) is:

We can see that the group has an effect significantly greater than 0 on the depression score after 1 month of treatment.

Once the four analyses have been performed, some additional outputs related to the repeated design are displayed.

The first table is very important and helps to validate the sphericity of the covariance matrix of the errors. This test is called Mauchly’s test.

We can see that the p-value is smaller than 0.05, we can say that the covariance matrix is spherical. In addition to Mauchly’s test, Greenhouse-Geisser epsilon and Huynt-Feldt epsilon are displayed. The more they are close to one, the more the covariance matrix has a spherical representation. In our example, the sphericity hypothesis is validated.

The two following tables can now be analyzed. First, the tests on the inter-subject effects which show the effect of the group variable on the whole dataset without taking into account the repetitions (or measures). We see that the group has a significant impact on the depression score. Then, the tests on the intra-subject effects show the impact of time (of the different measures) on the dependent variable. It can be useful to look at the interaction terms between repetition and the explanatory factors. We see that the repetition factor has a significant impact on the depression score; the interaction has also a significant impact.

This study has shown that both time and treatment have a significant impact on the depression score.

Some other output can be useful and are available in XLSTAT like residuals, residuals charts, least square means charts, multiple means comparisons...

Click here for other tutorials.