[R] HLM Model
jeremy.miles at gmail.com
Fri Jan 28 01:53:25 CET 2011
The empirical statement on the proc mixed line gives you robust
standard errors, I don't think you get them in R.
In SAS you specify that the predictors are to be dummy coded using the
class . Are they factors in R? I can't tell from the SAS output,
because the formatting has been lost. However, it appears that in R
you did not dummy code them. It also appears you haven't given use
all of the SAS output.
On 27 January 2011 15:52, Belle <ping.yi at gmail.com> wrote:
> 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
> 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:
> mixed<- lmer(Pre~trt+pairs+grade+school+(1|team), test)
> 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.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Psychology Research Methods Wiki: www.researchmethodsinpsychology.com
More information about the R-help