title: Running a linear mixed model (lmer, lme4) with pre-defined variance components in R
body: <p>I am creating a linear mixed model for which I did estimate/define my variance components in advance. Now I would like to add them to the function but I dont know how to do this. The currently used "lmer"-function from the "lme4"-package does estimate the variance components by itself and I dont know how to pre-define them.</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>For Example this data:
  
  library(lme4)
  
  f &lt;- rnorm(10, mean=1.4025, sd=0.101)
  m &lt;- rnorm(10, mean=1.9025, sd=0.15)
  gain &lt;-  c(f,m,f,m)
  s &lt;- c("f","f","f","f","f","m","m","m","m","m")
  sex &lt;- c(s,s,s,s)
  i &lt;- c(1:10)
  anim &lt;- as.factor(c(i,i,i,i))
  
  invented &lt;- data.frame(gain,sex,anim)
  
  # model
  
  lmm &lt;- lmer(gain ~ sex + (1|anim), data = d)
  summary(lmm)
  
  # How can I add variance components to the model?
  # Fixed-effect-variance = 0.0135
  # Random-effect-variance = 0.0045
  </code></pre>