2
$\begingroup$

I'm in the process of learning R, in the hope of replacing everything I do in SPSS/Sigmplot with R. It's going well so far :) I've got to the point of running a repeated-measures ANOVA, but have come unstuck when trying to plot the results

I've worked out how to plot a set of means using ggplot2, but now I'm unsure of how to plot the standard error as error bars. I've seen a number of guides with different implementations, and none of them seem to be appropriate (or even agree with each other). Many people use standard deviations, which is not what I am after. Others have different methods of computing the standard error, so I'm unsure of the best way to proceed.

What I have so far is this:

qplot(CATEGORIES, means, shape=factor(ANOTHER_CATEGORY), facets=MORE_CATEGORIES ~ ., data=alldata)

I was wondering if someone could point me in the right direction in terms of how to get the standard errors from a repeated-measures ANOVA in R, and then how to translate this into error bars in ggplot?

Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

The reason you're running into multiple methods is because the target variability to visualize in a repeated measures design is not necessarily that straightforward to determine.

If you calculate the conventional SE then what you've done is give an estimate of how well you calculated the raw score. However, generally in a repeated measures design that wasn't the goal of the study. What you are typically looking to do is to calculate an effect. The variability of that effect is much less. I generally recommend plotting your effects only and the variability of your effect estimates (better as confidence intervals than SEs). Then the error bar will represent something about what you actually attempted to study. The effect SE will be the sqrt(MSe/n) where n is the number of measurements of the effect (not to be confused with number of S's).

$\endgroup$
4
  • $\begingroup$ That's great - thanks! How would I go about plotting the effects? I can see the summary tables from the aov() function but there doesn't seem to be a way to get plots out easily. I'm sure there is and I've missed it..! $\endgroup$
    – vize
    Commented Apr 18, 2011 at 22:16
  • $\begingroup$ No, from aov there is not an direct way to get plots out easy. You need to get out your variables and plot them yourself. I can see that you're trying ggplot2. My answer was directed at what the error bar should be. To get error bars on your plot you just need to add geom_errorbar() to your plot. See the ggplot2 docs on that. $\endgroup$
    – John
    Commented Apr 18, 2011 at 23:25
  • $\begingroup$ An alternative is also to just use Mike Lawrence's ez package. You should look at that. $\endgroup$
    – John
    Commented Apr 18, 2011 at 23:26
  • $\begingroup$ Great, thanks! I have spent the day getting to grips with ggplot2. It's not been all that easy - but I'm getting there :) Thanks! I'll take a look at the ez package as well. $\endgroup$
    – vize
    Commented Apr 19, 2011 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.