Opens in a new tab

One-Way Repeated Measures ANOVA in Stata
Long Data and the Epsilon Table

A one-way repeated measures ANOVA in Stata needs long data and the repeated() option, which prints an epsilon table below the F test. Which p-value to report is decided before the output is seen, and incomplete series call for a mixed model.

What You'll Need
Long data: one row per occasion
A subject ID and a time variable
One continuous outcome measure

IN SHORT

What anova Fits and What repeated() Adds

A one-way repeated measures ANOVA compares the mean of a continuous outcome across three or more occasions or conditions in the same participants, separating stable differences between people from change across the occasions. To run a one-way repeated measures ANOVA in Stata, fit anova with the outcome, the subject variable and the time variable, then add repeated() naming the time variable. Stata prints the F test with its usual p-value and, beneath it, three epsilon estimates with adjusted p-values. OnlineSPSS, a specialist statistical consultancy for academic, clinical and professional research, carries out and reviews this analysis through an in-house PhD-level statistician.

In This Guide

1
Reshape to Long Format
2
Tabulate Occasions for Completeness
3
Plot the Outcome by Occasion
4
Fit anova With repeated()
5
Choose the p-Value Before Reading
6
Compute the Adjusted Degrees of Freedom

ANALYSIS SUPPORT

Analysis Support for This Method

This model works on complete series with fixed occasions. When participants miss visits or the timing differs between them, a mixed model uses the data more fully.

Repeated Measures ANOVA

Change across three or more occasions in the same participants, from the data layout and the epsilon adjustment to the effect size and the sentence that reports them.

Explore Repeated Measures ANOVA
Linear Mixed Models (Multilevel Modeling)

A model that uses every available measurement per participant, suited to incomplete series, uneven spacing between visits and predictors that change over time.

Explore Linear Mixed Models (Multilevel Modeling)

BEFORE YOU RUN IT

What anova Requires of a Repeated File

The command treats the participant as a factor, so the layout and the completeness of the data decide whether repeated() is usable at all.

Long Format, One Row per Occasion Long data for Stata ANOVA means one row per participant and occasion, with the outcome in one variable and the occasion in another. Wide files are converted with reshape long first.

A Subject Variable Entered as a Factor The participant ID goes into the model as a term of its own. Without it, rows from the same person would be treated as independent and the error term for time would be wrong.

Complete Series The repeated() calculation presupposes that each participant is measured at every occasion. A missing occasion leaves the data unbalanced, and a mixed model that keeps the available rows is generally the better route.

Occasions Fixed by Design The model treats the time points as categories, not as a trend. If the question concerns the shape of change, or the spacing between visits is uneven, the choice of model is revisited.

IN STATA

How to Run a One-Way Repeated Measures ANOVA in Stata

The anova repeated() option in Stata comes with Stata itself, and the epsilon table is printed once the option names the time variable.

1

Reshape to Long Format

If each participant sits on one row with a column per occasion, use reshape long so that every occasion has its own row.

Check: After reshaping, the number of rows should equal participants times occasions. A shortfall means some participants lack some occasions, which affects the model chosen.

2

Tabulate Occasions for Completeness

Tabulate the time variable, and count the rows per participant, to confirm that every participant has every occasion.

Watch: A balanced count of rows can hide missing outcome values, because the row exists while the outcome is empty. Count the non-missing outcomes at each occasion as well.

3

Plot the Outcome by Occasion

Draw a box plot of the outcome over time to see the pattern of change, the spread at each occasion and any extreme values.

Tip: A line plot of individual participants shows whether most follow the average pattern or whether the mean hides trajectories that move in different directions.

4

Fit anova With repeated()

Fit anova with the outcome, subject and time variables, then repeated(time) to request the epsilon estimates and adjusted p-values.

Tip: Name the time variable in repeated() and keep the model call in the do-file, because the epsilon estimates are printed for the repeated term that the option names.

5

Choose the p-Value Before Reading

Read the epsilon table and report the one adjusted p-value named in the analysis plan, never the smallest among those printed.

Watch: An epsilon near 1 means little adjustment is needed. Values well below 1 show that the differences between occasions vary in spread, and the adjusted p-values then matter more.

6

Compute the Adjusted Degrees of Freedom

Multiply both degrees of freedom of the F test by the chosen epsilon when the adjusted p-value is reported, and state the epsilon used.

Tip: Stata prints the adjusted p-values but not the adjusted degrees of freedom, so they are computed by hand or in a do-file line and kept with the log.

Stata Commands
reshape long y, i(id) j(time)
tabulate time
graph box y, over(time)
anova y id time, repeated(time)

READING THE OUTPUT

Reading the anova Table and the Epsilon Estimates

The usual anova table comes first, the error-term notes follow and the epsilon table closes the output, where most of the reporting decisions sit.

Output element What it tells you What to check
Number of obs and Root MSE The rows used and the typical size of the residual That obs equals participants times occasions
Source rows: Model, id, time, Residual How variation divides between people, occasions and what is left That the time row is the one read for change across occasions
time row: F and Prob > F The F test of change across occasions, with the unadjusted p-value That the unadjusted p is not quoted when the epsilon estimates are low
Between-subjects error term: id The term Stata would use as the error for a between-subjects factor; in a one-way design it simply names the participant variable That the id variable is the participant identifier
Repeated variable: time The factor treated as repeated That it is the occasion variable and not the outcome or the ID
Huynh-Feldt, Greenhouse-Geisser and Box’s conservative epsilon Three estimates of how far the differences between occasions depart from equal variances, with 1 meaning no departure That the estimate named in the plan is the one used
Prob > F columns: Regular, H-F, G-G, Box The p-value under each adjustment That one column is reported and named

REPORTING

Reporting the F Test With Its Epsilon Adjustment

Because the adjusted degrees of freedom are not printed, the reporting sentence needs a small calculation and a few named choices.

Report the F test as F(df time, df residual) = ___ with the epsilon adjustment named, the epsilon value and the adjusted p = ___, computing the adjusted degrees of freedom from the printed ones. Give the means and standard deviations at each occasion and the number of participants with complete series. Add an effect size such as partial eta-squared = ___ and name the error term it uses. An omnibus F does not say which occasions differ, so follow it with planned contrasts or adjusted pairwise comparisons and name the adjustment. State how incomplete series were handled, since the number analyzed can be smaller than the number recruited.

F With Adjusted pEpsilon NamedMeans by OccasionEffect Size NamedIncomplete Series

COMMON MISTAKES

Epsilon Choices and Degrees of Freedom Reported Wrongly

Four p-values to choose from and no adjusted degrees of freedom leave room for wrong sentences, and some of the six change the sentence more than the analysis.

Smallest p-Value Reported Choosing whichever of the four p-values is smallest, after seeing them, is a researcher degree of freedom. The adjustment is named before the output is read.

Unadjusted p With a Low Epsilon Quoting the Regular column when the epsilon estimates are well below 1 can understate the p-value, since that column assumes equal variances of the differences between occasions.

Adjusted p With Unadjusted df Pairing the adjusted p-value with the degrees of freedom as printed mixes two calculations. Both degrees of freedom are multiplied by the epsilon behind the p-value.

Participants Treated as Independent Leaving the subject variable out of the model treats every row as a separate observation, which inflates the error degrees of freedom and misstates the test of time.

Omnibus F Read as Pairwise Change A significant F says that the means differ somewhere across the occasions, not between which of them. The comparisons that follow carry their own adjustment.

Occasion Entered as a Trend Writing c.time in the varlist turns the occasions into one linear slope with a single degree of freedom, which asks whether the outcome changes steadily, not whether the occasion means differ.

Epsilon table printed but the p-value still open? Independent Statistical Review reads the adjustment named in your methods against the output and the number of complete series.

Request an Assessment

What's Next

An outcome ranked at each occasion, not measured, is analyzed with the Friedman Test.
Population-averaged effects over time are the target of Generalized Estimating Equations (GEE).
Only two occasions per participant reduce the design to a Paired Samples t-Test.

FREQUENTLY ASKED QUESTIONS

Questions About anova With repeated()

One test prints four p-values, real series have gaps and the effect size is requested after the fit with estat esize.

Report the single p-value named in the analysis plan, and state the epsilon adjustment behind it. When the estimates are close to 1, the four columns differ little. As epsilon falls, the adjusted columns move away from the regular one, and a frequently used convention prefers a more conservative adjustment when the estimates sit well below 1.

Not reliably: the method presupposes that each participant is measured at every occasion. A missing occasion leaves the data unbalanced, so the behavior of repeated() for your release should be checked in its documentation. A model fitted with mixed uses every available measurement under stated assumptions about missingness, which is why it is generally preferred.

In recent releases, estat esize after anova prints eta-squared values with intervals, and for the time term in this model the value is a partial eta-squared. Column labels vary by release, so name the measure and its error term in the text. A partial value from a repeated design is not directly comparable with one from a between-groups study.

An in-house PhD-level statistician at OnlineSPSS counts the complete series, discusses with you whether the anova route or a mixed model suits the design, and prepares the do-file for the chosen one. Quantitative Data Analysis is the service that fits the chosen model, and the researcher draws the conclusions about how participants changed.

Your data and project details are handled confidentially, and project information is not published. Researcher names and institutions are not used publicly without permission. An NDA is available where required and can be arranged before sensitive materials are shared. Read more about confidentiality and data security.

You share your research question, design and relevant materials, such as the dataset or the output you have, and a statistically trained Research Coordinator reviews the request and responds the same day. The analysis, deliverables, timeline and one fixed project fee are then confirmed before any work begins, so the timeline follows from the agreed scope.

Still have a question? Find more answers in our full FAQ.

View All FAQs →

NEXT STEP

Can a Reader Tell Which
Epsilon Produced Your p?

Three records make a repeated measures result traceable: the number of complete series, the named adjustment and the adjusted degrees of freedom. A long-format file or an anova log lets the assessment find which of them is not yet written down.

No Commitment Required

Strictly Confidential

Fixed Project Fee

In-House PhD-Level Statisticians

Same-Day Response

Serving Researchers Since 2014