I’ve been playing around with both nlme::lme and lme4::lmer.
I fitted a simple random intercept model using lme and lmer. As you can see below, I got completely different results from lmer() and lme(). Even signs of coefficients are different! Am I doing something wrong? I also fitted an empty model with two pakcages. In this case, the results were practically same (results not shwon). Would you educate me to understand this issue? Unless I made a mistake, I think there is something wrong with the lme4 package. Thank you.[![Data file image][1]][1]

 

    #lme
    > lme(y~x, random=~1|gid,data=multi,method="REML")
    Linear mixed-effects model fit by REML
      Data: multi 
      Log-restricted-likelihood: 41.76745
      Fixed: y ~ x 
    (Intercept)           x 
      4.1846756  -0.1928357 

 

    #lmer
      
    
     lmer(y~x+(1|(gid)), data=multi, REML=T)
        Linear mixed model fit by REML ['lmerMod']
        Formula: y ~ x + (1 | (gid))
           Data: multi
        REML criterion at convergence: -78.4862
        Random effects:
         Groups   Name        Std.Dev.
         (gid)    (Intercept) 0.70325 
         Residual             0.02031 
        Number of obs: 25, groups:  (gid), 5
        Fixed Effects:
        (Intercept)            x  
             2.8152       0.2638 


  [1]: https://i.sstatic.net/l4WPG.png