Home forums Mixed Models Including a covariate

Viewing 1 reply thread
  • Author
    Posts
    • #347
      Melvin Sim
      Participant

      Hello, I want to ask how do I include a co-variate in the model when using the aov-car function.
      Below is the syntax I have created, I am running a mixed model with time as a within variable and condition as a between variable:
      fit.grat2 <-aov_car(grat ~ condition*time + Error(PPT/time),
      data=mf_long2,
      covariate=centgrat)

      I have specified that centered trait gratitude (centgrat) is meant to be a covariate. My question is whether I have to include it in the actual model like so instead:
      fit.grat2 <-aov_car(grat ~ tgrat+condition*time + Error(PPT/time),
      data=mf_long2,
      covariate=centgrat)

      • This topic was modified 5 years, 8 months ago by Melvin Sim. Reason: For clarity
    • #351
      henrik
      Keymaster

      Sorry for the slow reply, your post somehow went through the cracks. You need to set factorize = FALSE in the call to use numerical covariates.

      For the example data that would be:

      data(obk.long, package = "afex")
      aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
              within = c("phase", "hour"), covariate = "age", 
              observed = c("gender", "age"), factorize = FALSE)

      In your case this would be:

      fit.grat2 <-aov_car(grat ~ tgrat+condition*time + Error(PPT/time),
      data=mf_long2, covariate=centgrat, factorize = FALSE)

      I should probably add a corresponding note to the documentation.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.