version (3.97 KB) by Andrew Penn
Corrects for violations of sphericity in repeated-measures ANOVA designs


Updated Tue, 21 Feb 2017 21:53:13 +0000

View License

% [epsilonhat DFn DFd] = epsilon (y, subj, gp, alg, DFn, DFd)
% Repeated-measures ANOVA assumes that error is purely random.
% A random factor that causes a measurement in one subject
% to be a higher (or lower) should have no affect on the next
% measurement in the same subject. This assumption is called
% circularity or sphericity. Sphericity, is therefore a measure
% of equality of variances of the differences between treatment
% levels.
% The adjusted degrees of freedom is returned to correct the p-
% value obtained from the treatment F statistic:
% padj = 1-fcdf(F,DFn,DFd)
% y is a vector of the data
% subj is a vector of subject identifiers
% gp is the number of treatment groups
% alg is the algorithm used (see below)
% DFn is the degrees of freedom in the numerator
% DFd is the degrees of freedom in the numerator
% y values must be ordered appropriately for each subject
% The algorithms include:
% 1) Greenhouse-Geisser (GG)
% - for 1-way repeated-measures ANOVA (conservative)
% 2) Huynh-Feldt-Lecoutre correction (HFL)
% - for 1-way repeated-measures ANOVA (less conservative)
% - for correcting violations of multisample sphericity in
% repeated-measures designs with >=2 independent groups
% The default is 'HFL', corresponding to the Lecoutre corrected form of
% the Huynh-Feldt adjustment [3]. The alternative is 'GG' for the
% Greenhouse-Geisser adjustment.
% Bibliography:
% [1] Maxwell and Delaney (2004) Designing Experiments and Analyzing
% Data: A Model Comparison. Psychology Press. Vol 1 p543
% [2] http://homepages.gold.ac.uk/aphome/spheric.html
% [3] Keselman, Algina and Kowalchuk (2001) The analysis of repeated
% measures designs: A review. British Journal of Mathematical
% and Statistical Psychology (2001), 54, 1-20

Cite As

Andrew Penn (2022). epsilon (https://www.mathworks.com/matlabcentral/fileexchange/61660-epsilon), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!