--- Tony Yang <tonyyangsxz@GMAIL.COM> wrote:
> Dear Listers;
> One more question about PROC NLMIXED, if I have a nominal variable
> which has 4 levels, and re-set another three variables for COLOR,
> color2, color3(letting level 4 as reference), then I include these
> variables in the modelling.
> My question is, if I want to test if there is difference between
> color1 and
> color2, color1 and color 3, color2 and color3, then how should I do
> I tried the following code,
> contrast "b1=b2" b1 1 b2 -1;
> contrast "b1=b3" b1 1 b3 -1;
> contrast "b2=b3" b2 1 b3 -1;
> there are error for this coding, hence I tried in SAS direction
> contrast "b1=b2" b1 +1, b2 -1;
> contrast "b1=b3" b1 +1, b3 -1;
> contrast "b2=b3" b2 +1, b3 -1;
> they works, while according to the syntax notes for contrast in PROC
> NLMIXED, it seems SAS is doing the simulaneous test for b1=-1 and
> b2=1, etc.
> Then I am not sure how to do this further, any suggestions will be
> appreciated. Thanks in advance for your time.
> Best regards,
The CONTRAST statement in NLMIXED does not follow the same
construction principals as, say, the GLM CONTRAST statement.
In GLM, you name an effect followed by the contrast coefficients
for each level of the effect. In NLMIXED, you use regular data
step type code to construct an equation for each orthogonal
contrast. The NLMIXED contrast statement has similarity to the
GLM contrast statement in that commas are employed to indicate
additional linear combination which are employed to construct
a multiple df hypothesis test.
The correct code to test whether the parameters b1=b2, b1=b3,
and b2=b3 would be as follows:
contrast "b1=b2" b1 - b2;
contrast "b1=b3" b1 - b3;
contrast "b2=b3" b2 - b3;
Let me make one other note about the NLMIXED contrast statement.
You can perform an omnibus test that b1=b2=b3=0 by specifying
contrast "Omnibus test for COLOR" b1, b2, b3;
Now, it might also be instructive to examine just what was coded
by your CONTRAST statements which "worked". You coded
contrast "b1=b2" b1 +1, b2 -1;
contrast "b1=b3" b1 +1, b3 -1;
contrast "b2=b3" b2 +1, b3 -1;
First, we see that each of these is a multiple df test because
of the commas which separate each linear combination. The two
linear combinations of the first contrast statement are
1 - H0: b1 + 1 = 0 OR b1 = -1
2 - H0: b2 - 1 = 0 OR b2 = 1
Since there are two independent linear combinations, then you get
the simultaneous test that b1=-1 and b2=1, just as you indicated.
Fred Hutchinson Cancer Research Center
Ph: (206) 667-2926
Fax: (206) 667-5977
Yahoo! Mail - PC Magazine Editors' Choice 2005