title: Equivalent of SAS proc mixed in R
body: <p>I'm trying to convert the following SAS code in R to get the same result that I get from SAS. Here is the SAS code:</p>
  
  <pre><code>    DATA plants; 
      INPUT  sample $  treatmt $ y ; 
      cards; 
  
      1   trt1    6.426264755 
      1   trt1    6.95419631 
      1   trt1    6.64385619 
      1   trt2    7.348728154 
      1   trt2    6.247927513 
      1   trt2    6.491853096 
      2   trt1    2.807354922 
      2   trt1    2.584962501 
      2   trt1    3.584962501 
      2   trt2    3.906890596 
      2   trt2    3 
      2   trt2    3.459431619 
      3   trt1    2 
      3   trt1    4.321928095 
      3   trt1    3.459431619 
      3   trt2    3.807354922 
      3   trt2    3 
      3   trt2    2.807354922 
      4   trt1    0 
      4   trt1    0 
      4   trt1    0 
      4   trt2    0 
      4   trt2    0 
      4   trt2    0 
      ; 
      RUN; 
  
      PROC MIXED ASYCOV NOBOUND  DATA=plants ALPHA=0.05 method=ML; 
      CLASS sample treatmt; 
      MODEL  y = treatmt ; 
      RANDOM int treatmt/ subject=sample ; 
      RUN; 
  </code></pre>
  
  <p>I get the following covariance estimates from SAS:</p>
  
  <blockquote>
  <pre><code>Intercept   sample  ==&gt; 5.5795     
  Treatmt  sample ==&gt; -0.08455      
  Residual         ==&gt; 0.3181    
  </code></pre>
  </blockquote>
  
  <p>I tried the following in R, but I get different results.</p>
  
  <pre><code>s=as.factor(sample) 
  lmer(y~ 1+treatmt+(1|treatmt:s),REML=FALSE) 
  </code></pre>