The function is an improved version of the previous teg_repeated_measures_ANOVA, that should now provide identical results to SPSS.
Important: the calculation of epsilon was updated on 24 Nov 2013.
The usage is
O = teg_repeated_measures_ANOVA(M, levels, varnames)
where M is an N x k matrix of N observations of k nested combinations of factors, as ordered in SPSS. levels is a vector of number-of-levels per factor, from highest to lowest level. varnames is a cell array of variable names.
EXPERIMENTAL: discrete between-subject factors can be added as follows:
O = teg_repeated_measures_ANOVA(M, levels, varnames, B, Between_varnames)
where each column of B contains each subject's level of a between-subject factor, and Between_varnames is again a cell array of strings containing the variable name for each column of B.
The function outputs the F-test, sum of squares, mean squares, epsilon, partial eta squared and the means and standard errors per level of factors going into the test. Violation of sphericity is corrected for using an approximation of Greenhouse-Geisser correction.
The M matrix can be expanded by concatenating a submatrix of trial numbers, so M = [M N] where N is the size of the original M. The nice thing about that is that adding or removing factors should leave test results unchanged.
Various parameters can be changed at the top of the teg_repeated_measures_ANOVA file, in particular the critical p-values at which test results are printed out and verbosity (verbose0) which, when set to 1, provides pairwise t-tests to help understand interactions.