[R] Conveting SAS Proc mixed to R code

Kevin Wright
Thu, 14 Apr 2011 20:51:10 -0000

> I am trying to teach myself R and replicate some previous SAS analysis.
> Could someone please help me translate the following SAS code into R.
>
> Proc mixed method=ml
> Class Group Treatment Stream Time Year;
> Model Logrpk=Treatment Time Treatment*Time;
> Random Group Stream (Group Treatment) Year(Time);
>

Assuming you have a data frame "dat" with these factors: Group
Treatment
Stream Time Year
And continuous response: logrpk

This code is a starting point: (I'm not sure exactly what the SAS syntax
means).

require(lme4)
m1 = lmer(logrpk ~ treatment*time + (1|Group) + (1|Stream:Group:Treatment) +
(1|Year:Time), data=dat)

Kevin

	[[alternative HTML version deleted]]