4

How should these two models be interpreted differently? Specifically, what is the circumstance where you would run one over the other?

aov(Temperature~Day+Error(Subject)) 
aov(Temperature~Day+Error(Subject/Day)) 

We'll use an example where I measured the temperature of 10 people once every day for a week. My main interest is to see if the temperature measurements change significantly day-to-day, and I am not interested in the longitudinal trend from Monday to Sunday.

amoeba
  • 93,463
  • 28
  • 275
  • 317
AtMac
  • 67
  • 5

1 Answers1

10

Depending on the contrasts you are using, the R command

aov(Temperature~Day+Error(Subject))

fits a model like

$$y_{ij} = \mu + \beta_j + b_i + \epsilon_{ij},$$

where $y_{ij}$ is the response value for the $i$th individual at the $j$th period (day), $\mu$ is global mean, $\beta_j$ is the effect of $j$th day, $b_i\sim N(0,\sigma_b^2)$ is the Gaussian random effect or random intercept for the $i$th individual and $\epsilon_{ij}\sim N(0,\sigma^2)$ is the Gaussian residual term. The unknown parameters are $(\mu, \beta_j,\sigma_b^2, \sigma^2)$.

On the other hand, the command

aov(Temperature~Day+Error(Subject/Day)) 

fits the model

$$y_{ijk} = \mu + \beta_j + b_i + b_{ij} + \epsilon_{ijk},$$

where $b_{ij}\sim N(0, \sigma_1^2)$ is a Gaussian random individual-period interaction term. As you can see from the expression, to estimate also $\sigma_1^2$ you need to have replications for each $i$ and $j$, that's the reason for the third index $k$.

amoeba
  • 93,463
  • 28
  • 275
  • 317
utobi
  • 1,013
  • 10
  • 24
  • So in a very loose (probably naive) way, is aov(Temperature~Day+Error(Subject)) analogous to lm(Temperature~Day+Subject)? Also, and this is probably obvious for many reasons, how does aov(Temperature~Day+Error(Subject/Day)), differ from the mixed model lmer(Temperature~Day + (1|Subject))? – AtMac Nov 24 '16 at 13:38
  • 1
    aov(Temperature~Day+Error(Subject)) vs lm(Temperature~Day+Subject): the former has two variance components, one for the random effects at the Subject level and one for the residuals. The latter has only one residual variance, no random effects but has fixed effects for Subject. – utobi Nov 25 '16 at 09:10
  • 1
    lmer(Temperature~Day + (1|Subject)) is theoretically identical to aov(Temperature~Day+Error(Subject)) – utobi Nov 25 '16 at 09:11
  • 1
    aov(Temperature~Day+Error(Subject/Day)) includes a further random effect, which is an interaction between Subject and Day. So this model has three variance components. It can be estimated iff you have replication for each Day and Subject, which, as far as I understood you do not! – utobi Nov 25 '16 at 09:13
  • +1. @AtMac: `aov(Temperature~Day+Error(Subject/Day))` corresponds to `lmer(Temperature~Day+(1|Subject)+(1|Subject:Day)` which is the same as `lmer(Temperature~Day+(1|Subject/Day)`. – amoeba Jun 28 '17 at 09:09