Skip to content

lmer and SAS proc mixed

3 messages · Douglas Bates, Viechtbauer Wolfgang (STAT), Emmanuel Charpentier

#
On Tue, May 26, 2009 at 1:25 PM, Julia Liu <liujulia7 at gmail.com> wrote:
I know what the lmer model fits but I don't know SAS PROC MIXED that
well so I can't tell you what model the SAS code would fit.  I have
sent a copy of this reply to the R-SIG-Mixed-Models mailing list in
the hopes that someone reading that list could say what model would be
fit.

The fact that the estimates coincide when you remove the random effect
for x1 indicates to me that the variance-covariance structure of the
model description for SAS may be other than the general positive
definite structure (which in SAS is called "unconstrained", I believe,
despite the fact that the matrix is subject to several constraints)
used in lmer.
#
Try:

proc mixed data=dt;
	class pid;
	model y= &fvars / solution outp=predicted;
	random intercept x1/sub=pid type=un solution;
	ods output SolutionF=fbeta;
	ods output SolutionR=rbeta;

(note the addition of type=un on the line starting with random). I believe type=vc is the default, which does not allow the random intercept and slope to be correlated (which lmer does).

Best,
#
Le mardi 26 mai 2009 ? 21:10 +0200, Viechtbauer Wolfgang (STAT) a
?crit :
Can the parametrzation also play a role ?

In this case, I don't think : pid is the only "class" variable declared
in this proc step, which implies (or implied, in the times I was a SAS
user) that X1-...-X5 are continuous variables. Unless SAS started to
support a permanent class attribute in his datasets since v6.x (the last
I used with any kind of regularity)...

But I remember having been bitten by this  when first trying to learn R
and hitting differences in regression/ANOVA coefficients. And, yes, the
dreaded "Type III SS" problem, which Bill Venables' "Exegeses on the
linear model" considerably enlightened.

					Emmanuel Charpentier