[R-sig-ME] mixed model basic question and mixed model equivalent of SAS estimate

Douglas Bates bates at stat.wisc.edu
Mon Nov 7 18:01:15 CET 2011


I see that you have sent your query to the
R-SIG-Mixed-Models at R-project.org list, which is the recommended
procedure.  I can't really help because I don't use SAS and don't know
(or want to learn) the SAS syntax.

On Sun, Nov 6, 2011 at 7:54 PM, John Clark <rosbreed.pba at gmail.com> wrote:
> I want to fit a mixed model using nlme package in R which is equivalent to
> following SAS codes:
> proc mixed data = one;
> class var1 var2  year loc rep;
> model yld = var1 * var2;
> random loc year(loc) rep*year(loc);
> estimate "mean" intercept 5 var1*var2 1 0 0 0 0 1 0 0 0 1 0 0 1 0 1 /
> divisor = 5;
> I tried the following codes:
> require(nlme)
> fm1 <- lme(yld ~ var1*var2, data = one, random = loc + year | loc + rep *
> year | loc)
> I have few basic questions:
> (a) model and random term specification -  is the above code correct. If not
> or there is better way to do it in other packages including lme4
> (b) estimate - I do not know how to apply contrasts to the interaction
> term. When contrast are applied, how are treatment level sorted in R so that
> my orthogonal contrast are not wrong.
>
>




More information about the R-sig-mixed-models mailing list