Repeated Measures ANOVA - syntax is hard


TS Contributor

I am trying to run a rm anova in STATA.

I have a dependent variable Y, a grouping variable (independent) X, which is my treatment variable, and each subject is measured twice, so the repeated measures variable is R. The subject variable is S (R=1,2 S=1,2,3,.... X=1,2,3)

I can't figure out how to do it in STATA, I mean, it let's me run a RM ANOVA with a within subject term only, but when I include X, it shouts at me to add bse() or something. Every online example is full of interactions, how can I run a SIMPLE RM ANOVA model ?



TS Contributor
Still with the same problem (3 groups, 2 repeated measures), does anyone knows how to do the Friedman's test in STATA ?
I failed doing it with other software


-help anova- has a simple example without interactions. It's difficult to troubleshoot your code when you haven't shown us the code.

You can do a Friedman test using the -emh- user-written Stata package. Install it with -ssc install emh-. See here


TS Contributor
thanks for the link to the Friedman test, I'll give it a go (it is a replacement to repeated measures anova, right ?)

I know the anova example, the problem with it, is that it has only the within subject effect, while I need both a within subject effect AND a between group effect.

I tried various options, I can give you examples:

anova Y X S R, repeated(R)

where Y is my response (which isn't normally distributed, problem !). X is the treatment factor with 3 levels. R is the repeated measure, Y is measured twice for every subject (S).

the error was: could not determine between-subject error term; use bse() option

another option:

anova Y X S, repeated(S)
could not determine between-subject basic unit; use bseunit() option

I have the data both in the long and wide formation, I just need anything to work. I went to a PC with other software and it worked smoothly, but I need it to be done in STATA.

any ideas how to solve the problem that Y is not normally distributed ? Friedman ?

cheers !