title: How to convert Afex or car ANOVA models to lmer? Observed variables
body: <p>In the <code>afex</code> package we can find this example of ANOVA analysis:</p>
  
  <pre><code>data(obk.long, package = "afex")
  # estimate mixed ANOVA on the full design:
  # can be written in any of these ways: 
  
  aov_car(value ~ treatment * gender + Error(id/(phase*hour)), data = obk.long,
          observed = "gender")
  
  aov_4(value ~ treatment * gender + (phase*hour|id), data = obk.long,
          observed = "gender")
  
  aov_ez("id", "value", obk.long, between = c("treatment", "gender"), 
         within = c("phase", "hour"), observed = "gender")
  </code></pre>
  
  <p>My question is, How can I write the same model in <code>lme4</code>?
  In particular, I don't know how to include the "observed" term?</p>
  
  <p>If I just write </p>
  
  <pre><code>lmer(value ~ treatment * gender + (phase*hour|id), data = obk.long,
       observed = "gender")
  </code></pre>
  
  <p>I get an error telling that observed is not a valid option.</p>
  
  <p>Furthermore, if I just remove the observed option <code>lmer</code> produces the error:</p>
  
  <blockquote>
    <p>Error: number of observations (=240) &lt;= number of random effects (=240) for term (phase * hour | id); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable.</p>
  </blockquote>
  
  <p>Where in the lmer syntax do I specify the "between" or "within" variable?.  As far as I know you just write the dependent variable on the left side and all other variables on the right side, and the error term as (1|id).</p>
  
  <p>The package "car" uses the idata for the intra-subject variable.</p>