title: Crossed and Nested Random Effects in lme4
body: <p>Let's say I design a study where I want to examine learning trends over time to see if they differ between men and women. The outcome variable is number of words learned (<strong>recall</strong>). My predictor variables are <strong>sex</strong>, emotional <strong>valence</strong> of the words (negative, neutral, or positive), and <strong>time</strong>. I want to know if there is an interaction between sex, valence, and time, such that men and women have different learning trajectories depending on the emotional valence of the word. I'm trying to analyze these data in lme4. </p>
  
  <p>The initial code I was using did not account for the crossed nature of the design; that is, each level of valence is present at each time point for each participant. It's shown below. <strong>PID</strong> is my participant ID.</p>
  
  <pre><code>lmer(recall ~ time*sex*valence + (1 + time | PID), data = data)
  </code></pre>
  
  <p>Can anyone tell me how to write out the syntax for this model in lme4? </p>