title: How to fit a mixed effects model regression with interaction in R ggplot2?
body: <p>The dataset I'm working with has an interaction term. I want to fit the model with the interaction term in the x-axis and the <code>y.var</code> in the y-axis. I tried following <a href="https://cran.r-project.org/web/packages/sjPlot/vignettes/plot_interactions.html" rel="nofollow noreferrer">this</a> example but didn't get too far on how to replicate it in ggplot2 (i.e. the plot style function doesn't work anymore..so I didn't know how to replicate the results).</p>
  <pre><code>temp &lt;- rnorm(100, 2,1)set.seed(111)
  temp &lt;- rnorm(100, 3,1)
  rainfall &lt;- rnorm(100,5,1)
  y.var &lt;- rnorm(100, 2,1)
  site &lt;- rep(c(&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;), each = 25)     
  
  df &lt;- data.frame(temp, rainfall, y.var, site)
  df$site &lt;- as.factor(as.character(df$site))
  
  mod &lt;- lmer(y.var ~ temp * rainfall + (1|site), data  = df)
  summary(mod)
  </code></pre>