1

I am running ANOVA to test for a significant effect for some data, and a grad student said I should run an ANOVA test formatted like this in R to test for significance:

 x<- aov(angle~cond+sub)

where cond=condition with 4 levels (other, joint,self,diff), and sub=subject. My data being analyzed is formatted as follows:

sub   phase   cond     angle

1     1       diff     55.25
1     2       self     25.75
2     1       diff     38.65
2     2       other    55.75
3     1       diff     21.55
3     2       joint    65.65 
4     1       joint    55.00
4     2       other    51.51

and so on,
so each subject is only exposed to two of the four conditions. I get that the aov() formula he gave me is essentially trying to find the effect of condition on angle, while accounting for the variance caused by the effect of subject on angle. I am just a little confused then exactly what type of ANOVA I am running as I know the format of blocked ANOVA, two way ANOVA (without interactions), and ANCOVA all look generally like aov(Y~X + Z). Just looking for clarification.

Carl
  • 11,532
  • 7
  • 45
  • 102
  • It's not ancova, because for ancova one of the independent variables would have to be continuous. To me, it 's a blocked model, because you're treating `subject` as a block. But it doesn't matter what you call it. They're just names to help understanding. You're using a *general linear model* approach, which is flexible enough to include all kinds of independent variables. BTW, if you have many subjects, you might want to treat `subject` as a random effect rather than a fixed effect. – Sal Mangiafico Nov 29 '19 at 22:01

1 Answers1

2

Looks like a two-way ANOVA without interaction to me:

  • "condition" is a factor with 4 levels
  • "subject" seems to be a factor with n levels.

Note that, depending on your exact protocol, a linear mixed model taking "subject" as a random effect may better represent the structure of your data. In which case look for lme or lmer functions of resp. nlme and lme4packages. But it's up to you, and the grad student. See here for a discussion.

Sidenotes, if you stick to a non-mixed model (i.e. your current model). I'm by no means an expert in statistics nor R, but I'd like to add that:

  • I've read somewhere that the aov function sometimes creates trouble, and that it's better to use lm instead. Can't provide a source, though.
  • when getting the p-values from your ANOVA, consider the use of the Anova function from the car package rather than the standard anova function (from base). Why? Because the Anova function does not consider the first factor (here, "condition") to be more important than the second ("subject"). And that's generally what you want.
user137473
  • 41
  • 5