# Repeated Measures ANOVA Calculator

Within-subjects design, the same subjects show up in each group, or exposed to every treatment.

The tool ignores empty cells or non-numeric cells.

## One-way repeated measures ANOVA test

The test is also called **one-way ANOVA with dependent groups.**

The one-way repeated measures ANOVA checks if the difference between the averages of two or more dependent groups is significant.

While on one-way ANOVA each subject appears only in one group, on one-way repeated measures ANOVA each subject appears in every group. A one-way repeated measures ANOVA contains only one categorical variable, each group/treatment is one value of the categorical variable.

For two categorical variables, use the two-way ANOVA calculator. The paired t-test is a special case of repeated measures ANOVA with two groups.

If you use a two-way mix model ANOVA with no repeat, with the subject as a random factor, and the group as a fixed factor you will get the same results.

#### Targets

The repeated measures ANOVA test checks if the difference between the averages of two or more dependent groups is significant when every subject appears in each group.

When performing the repeated measures ANOVA test, we try to determine if the difference between the averages reflects a real difference between the groups, or is due to the random noise inside each group.The F statistic represents the ratio of the variance between the groups and the error. Unlike many other statistic tests, the smaller the F statistic the more likely the averages are equal.

**Right-tailed**F test, for the ANOVA test you can use only the right tail. Why?

_{0}: μ

_{1}= ... = μ

_{k}

_{1}: not(μ

_{1}= ... = μ

_{k})

F = | MS_{Treatment} |

MS_{Error} |

### How to use the repeated measures ANOVA calculator?

**Significance level (α)**: A p-value less than the significance level is statistically significant.

Researchers usually use 0.05, but if the price of a mistake is big, they may use a smaller value like 0.01.**Correction method**- correct the significance level(α) for the multiple comparisons.**No correction**- use the significance level you entered for the repeated measures ANOVA, without a correction.**Bonferroni correction****Sidak correction****Sphericity Correction**- the repeated measures ANOVA calculator checks the Sphericity assumption using Mauchly's test.

The violation of the Sphericity leads to a too liberal test with an inflated type I error.

Like many statistical tests, Mauchly's test has the following problems:

Small sample size - weak test power to reject the sphericity assumption.

Large sample size - strong power to reject even a minor violation of the sphericity assumption.

Hence it might be better to run the sphericity correction in all cases, independent of Mauchly's test result.

Following the options:**Automatic**- use the Greenhouse-Geisser correction only if Mauchly's test rejected the Sphericity assumption.**Greenhouse-Geisser**- always use the Greenhouse-Geisser correction even if the Sphericity assumption could not be rejected (i.e., Mauchly's test is not significant, p > 0.05).**Hyunh-Feldt**- always use the Hyunh-Feldt correction even if the Sphericity assumption could not be rejected.**No correction**- don't use any Sphericity correction, even if Mauchly's test rejected the Sphericity assumption.**Outliers:**extreme values, the calculator uses Tukey's Fences method with k=1.5 to identify the outliers based on the residuals.

for other methods, you may use the outlier calculator.

The calculator only identifies the outlier but doesn't exclude it. you should exclude outliers only if you identify them as error data.**Advanced fields - for sample size**

When planning the experiment, you should choose the effect size that the test should identify. You should choose the sample size before conducting the research. We added this field to alert users that didn't calculate the sample size or did it incorrectly.

If you use the calculator for homework you may ignore these fields.**Effect**- If you don't know the required effect size, you may use the 'effect' field. The default is 'Medium', if you change the value, it will change 'effect type' to 'Standardized effect size' and fill the proper value per Cohen's suggestion in the 'effect size' field. (0.2: Small, 0.5: medium, 0.8: large) The calculator will not use this field when pressing the 'calculate' button.**Effect type****f**- effect size.**f**- effect size.^{2}**η**- ETA squared = SSB / (SSB + SSE)^{2}**Effect size**- the value that you want the test to be able to identify. You need a larger sample size to be able to identify a smaller effect size.**Rounding**- how to round the results?

When a resulting value is larger than one, the tool rounds it, but when a resulting value is less than one the tool displays the significant figures.**How to enter data?****Enter data in a table**- enter one value in each cell.**Enter data in columns**- each column is one group or treatment.

The order in the column represents the subject, for example, the second value in each column represents subject #2.**Enter data from excel**- copy the*raw data*with the*group header*and without the subjects left column, and paste in the calculator. you may copy from Excel or Google sheets, or any tool that separates data with tab and line feed. copy the entire block, and include the header.

## Assumptions

- The dependent variable is continuous (ratio or interval)
- One categorical independent variable
- Each subject appears in each group/treatment
- The residuals distribution is normal
- Sphericity - equality of variances of the differences between the groups

## Required Sample Data

Sample data from all compared groups

## Parameters

**a**- the number of subjects, number of rows.

**b**- the number of groups, number of columns.

**n**- overall sample size, n = a * b.

**Ȳ**- an average of all the observations of subject i of variable A - subjects (row i).

_{i}**Ȳ**- an average of all the observations of group j of variable B - treatments/groups (column j).

_{j}**Ȳ**- overall average (ΣY

_{i,j}/ n, i=1 to a, j=1 to b.

## Results calculations

### Sum of squares

The sum of squares accumulates the squared differences related to the effect we try to estimate.**SS**- the squared differences related to the effect of variable A. You compare the average of every category to the total average. The same value as the sum of squares between groups in one-way ANOVA.

_{A}**SS**- the same as SS

_{B}_{A}, for variable B.

and compare to the total average.

**A effect**= Ȳ

_{i}- Ȳ

**B effect**= Ȳ

_{j}- Ȳ

**Error**= Cell average - A effect - B effect - Total average.

= Ȳ

_{i,j}- (Ȳ

_{i}- Ȳ) - (Ȳ

_{j}- Ȳ) - Ȳ.

= Ȳ

_{i,j}- Ȳ

_{i}- Ȳ

_{j}+ Ȳ.

Take the square of each difference

(Ȳ

_{i,j}- Ȳ

_{i}- Ȳ

_{j}+ Ȳ)

^{2}.

Count the square differences of each value in the cell.

**SS**=Σ

_{E}_{i}

^{a}Σ

_{j}

^{b}n

_{i,j}(Ȳ

_{i,j}- Ȳ

_{i}- Ȳ

_{j}+ Ȳ)

^{2}

Example: Compare the blood pressure results over time, check each subject's blood pressure before treatment, after one week and after two weeks.

Treatments/Groups: Before treatment, after 1 week, after 2 weeks.

Multiple measures of each subject

### ANOVA table

Source | Degrees of Freedom (DF) | Sum of Squares (SS) | Mean Square (MS) | F statistic | p-value |
---|---|---|---|---|---|

A - Subjects (rows)Between the subjects | DF_{A} = a - 1 | SS_{A} = Σ_{i}^{a}b(Ȳ_{i}-Ȳ)^{2} | MS_{A} = SS_{A} / DF_{A} | F_{A} = MS_{A} / MS_{E} | P(x > F_{A}) |

B - Treatments (Columns)Between the treatments | DF_{B} = b - 1 | SS_{B} = Σ_{j}^{b}a(Ȳ_{j}-Ȳ)^{2} | MS_{B} = SS_{B} / DF_{B} | F_{B} = MS_{B} / MS_{E} | P(x > F_{B}) |

ErrorWithin the cells | DF_{E} = n - a - b + 1 | SS_{E}=Σ_{i}^{a}Σ_{j}^{b}(Y_{i,j} - Ȳ_{i} - Ȳ_{j} + Ȳ)^{2} | MS_{E} = SS_{E} / DF_{E} | ||

TotalAll the deviations from the average | DF_{T} = n - 1 | SS_{T}=Σ_{i}^{a}Σ_{j}^{b}(Y_{i,j} - Ȳ)^{2}SS _{T}=Sample Variance*(n-1)SS _{T}=SS_{A}+SS_{B}+SS_{E} | MS_{E} = S^{2} = SS_{T} / (n - 1) |

### Sum of squares diagram

In the following diagram, you may see the differences per each observation Y_{i,j}that used to calculate the sum of squares.

A - Treatments effect: Ȳ

_{i}- Ȳ.

B - Subjects effect: Ȳ

_{j}- Ȳ.

Error: Y

_{i,j}- Ȳ

_{i}- Ȳ

_{j}+ Ȳ.

Total effect: Y

_{i,j}- Ȳ.