[R] Standard error of mean for aov

David Winsemius dwinsemius at comcast.net
Sat Dec 13 19:30:55 CET 2008

On Dec 13, 2008, at 11:37 AM, Jason Augustyn wrote:

> Hi David, thanks for the quick response. I did look at the help  
> files for model.tables and se.contrast and neither seemed  
> appropriate. I probably wasn't clear enough in my original email, so  
> here's more information:
> I'm analyzing data from a psychology experiment on how people  
> allocate visual attention when walking over difficult terrain. In  
> the experiment subjects walked on a treadmill for 30 minutes while  
> performing an attention-demanding reaction time task. In one  
> condition they could walk freely, whereas in another condition they  
> had to avoid markings placed on the treadmill belt to simulate  
> obstacles. The stimuli for the reaction time task were placed either  
> at eye-level or near the ground.
> The dependent measure I'm working with comes from an eye-tracking  
> system that we ran while subjects walked, which provided data on the  
> amount of time subjects looked at the reaction time stimuli versus  
> the treadmill belt. We divided the fixation time data sets for each  
> subject into three time bins to look at changes in fixation behavior  
> over time.
> So the full design of the study is a 2x2x2x3 with repeated measures  
> on all factors. The factors were:
> Markings (Levels: present, absent)
> Reaction time task "Position" (Levels: eye-level, ground-level)
> Eye fixation "Plane": (Levels: RT stimuli, treadmill belt)
> Time bin (Levels: 1,2,3)
> A call to aov yields main effects of Markings, Position, and Plane,  
> as well as a Markings*Plane interaction. For comparison purposes I  
> ran the same analysis in SPSS and got equivalent ANOVA results, so  
> I'm confident the model has been set up properly in R.
> Now, what I want to get are means and standard errors for the main  
> effects and interaction to generate figures for publication using  
> other software. As stated in my initial post, I got the means using  
> model.tables and they are correct as compared with the SPSS output.  
> However, I cannot get the standard errors for the means. I've tried  
> various things in R and cannot get values that correspond to the  
> SPSS output.

My understanding is that the se's are for the effects, i.e. on  
parameter estimates for differences, rather than for the means  
themselves. One get these (at least in the example on the help page)  

model.tables(npk.aov, "means", se = TRUE)

Does not this give you what you need?

model.tables(rawfixtimedata.aov,"means", se=TRUE)

I am not sure what you are referring to when you ask for  se's for the  
"means" in the presence of interactions. How are you going to  
partition the cases? Would one case contribute to both the main "mean"  
and to any or all the interaction "means" in which it might be involved?

David Winsemius
> Again, I assume there is an R function that can get me the values I  
> need and would hugely appreciate any pointers. In case you're  
> wondering why I'm bothering with running the analyses in R given  
> that I already have them done in SPSS, I'm just generally interested  
> in learning to use R to have an additional analysis tool in my  
> toolkit.
> Thanks for any help!
> Cheers,
> Jason
> On Sat, Dec 13, 2008 at 9:04 AM, David Winsemius <dwinsemius at comcast.net 
> > wrote:
> On Dec 12, 2008, at 10:59 PM, JS.Augustyn at gmail.com wrote:
> Hi all,
> I'm quite new to R and have a very basic question regarding how one  
> gets
> the standard error of the mean for factor levels under aov. I was  
> able to
> get the factor level means using:
> summary(print(model.tables(rawfixtimedata.aov,"means"),digits=3)),
> where rawfixtimedata.aov is my aov model. It doesn't appear that  
> there is
> an equivalent function to get the standard errors for the factor  
> levels.
> I searched through the help archives and documentation but could not  
> find
> anything that would help resolve my problem. I'm sure there is a  
> trivial
> solution, but I would sincerely appreciate having someone more expert
> dispel my ignorance.
>  Have you looked at the help page for model.tables? ... and perhaps ? 
> se.contrast
> There are arguments to that function that result in standard errors  
> for _effects_. If standard errors on the contrasts are not what you  
> wanted, then perhaps a full example would help.
> -- 
> David Winsemius
> Cheers,
> Jason Augustyn
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list