[R] HLM Model

Belle ping.yi at gmail.com
Fri Jan 28 00:52:13 CET 2011


Hi Harold:

I know the outputs are different between SAS and R, but the results that I
got have big difference.

Here is part of the result based on the SAS code I provided earlier:

                                Cov Parm     Subject    Estimate       Error    
Value      Pr > Z

                                UN(1,1)      team        177.53      273.66       
0.65       0.2583
                                Residual                    2161.15    
67.1438      32.19      <.0001

                                                   Solution for Fixed
Effects

                                                                                    
Standard
 Effect          pairs    grade      school        Estimate       Error     
DF    t Value    Pr > |t|

 Intercept                                             638.82       4.6127      
5     138.49      <.0001
 trt                                                      -0.2955     
3.4800       5      -0.08      0.9356
 pairs              1                                    0.1899       7.1651      
5       0.03      0.9799
 pairs              2                                    31.1293      6.0636     
5       5.13      0.0037
   .
   .
   .

In R:
library(lme4)
mixed<- lmer(Pre~trt+pairs+grade+school+(1|team), test)

result:

Random effects:
 Groups                 Name        Variance Std.Dev.
 team               (Intercept)     568.61  23.846  
 Residual                               2161.21  46.489 

Fixed effects:
                          Estimate        Std. Error    t value
(Intercept)                540.402     43.029       12.559
trt                           7.291        13.084        0.557
pairs                       -3.535         6.150        -0.575

In random effect, the variance of team in SAS is 177.53, but it is 568.61 in
R. Also I have negative estimate for trt in SAS but positive estimate for
trt in R. I am wondering how this happened, and how can I solve this problem
so that I can get similar result from both software.

Also does R provides result for fixed effect of each level? For example, the
result of pair1, pair2,pair3,..., and grade1, grade2, grade3,...

-- 
View this message in context: http://r.789695.n4.nabble.com/HLM-Model-tp3242999p3243475.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list