5
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ do you have replication per individual&day? $\endgroup$
    – utobi
    Nov 23, 2016 at 21:57
  • $\begingroup$ Every person is measured once per day.... 7 measures per person, 70 measures total. Does that help? $\endgroup$
    – AtMac
    Nov 23, 2016 at 22:01
  • $\begingroup$ Yes, see my answer below. $\endgroup$
    – utobi
    Nov 24, 2016 at 0:25
  • $\begingroup$ Related: stats.stackexchange.com/questions/60108. Also: stats.stackexchange.com/questions/51520. $\endgroup$
    – amoeba
    Jun 21, 2017 at 20:47

1 Answer 1

11
$\begingroup$

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$.

$\endgroup$
5
  • $\begingroup$ 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))? $\endgroup$
    – AtMac
    Nov 24, 2016 at 13:38
  • 1
    $\begingroup$ 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. $\endgroup$
    – utobi
    Nov 25, 2016 at 9:10
  • 1
    $\begingroup$ lmer(Temperature~Day + (1|Subject)) is theoretically identical to aov(Temperature~Day+Error(Subject)) $\endgroup$
    – utobi
    Nov 25, 2016 at 9:11
  • 1
    $\begingroup$ 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! $\endgroup$
    – utobi
    Nov 25, 2016 at 9:13
  • $\begingroup$ +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). $\endgroup$
    – amoeba
    Jun 28, 2017 at 9:09

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.