Programming the statistical procedures from SAS

[proc glm] contrast is not estimable

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

[proc glm] contrast is not estimable

[ Edited ]
data aaa;
input x1 x2 y @@;
datalines;

1 1 0.02  1 1 0.01 1 1 0.07 1 1 0.04 1 1 0.01 1 1 0.09 1 1 0.05 1 1 0.06
1 2 0.05 1 2 0.01 1 2 0.04 1 2 0.03  1 2 0.02 1 2 0.02 1 2 0.13 1 2 0.06
2 1 0.15 2 1 0.11 2 1 0.22 2 1 0.05  2 1 0.09 2 1 0.05 2 1 0.15 2 1 0.11
2 2 0.14 2 2 0.21 2 2 0.06 2 2 0.12 2 2 0.11 2 2 0.19 2 2 0.12 2 2 0.04
3 1 0.09 3 1 0.03 3 1 0.18 3 1 0.12 3 1 0.18 3 1 0.43 3 1 0.24 3 1 0.4
3 2 0.02 3 2 0.19 3 2 0.15 3 2 0.07 3 2 0.45 3 2 0.2 3 2 0.49 3 2 0.19
;
proc glm data=aaa;
class x1 x2;
model y=x1 x2 x1*x2;
contrast 'linear trend1' x1 -2 0 2 x1*x2 -1 0 1 -1 0 1;
run;

 

I am trying to get linear trend with interaction, and this contrast coding returned to me with a message that contrast is not estimable. Can somebody clear me out why it's not estimable? I tried bunch of other contrasts, but still the same. Thank you always for your help in advance. 

 

 


Accepted Solutions
Solution
‎05-06-2018 06:37 PM
SAS Employee
Posts: 97

Re: [proc glm] contrast is not estimable

I would also suggest adding the E option to the ESTIMATE which will match the coefficients of the L vector up with their respective parameters. 

contrast 'linear trend1' x1 -2 0 2 x1*x2 -1 0 1 -1 0 1/e;

When you do that for this example you will notice that you are applying coefficients in the interaction to parameters where x1=2.

 

You need to have the interaction coefficients match up with the levels in the main effect.  Something like this would be estimable:

contrast 'linear trend1' x1 -2 0 2 x1*x2 -1 -1 0 0 1 1/e;

 

But you would need to decide if this is actually what you want.

 

To understand the logic of CONTRAST/ESTIMATE statements, I would (in addition to what Rick suggested) add these examples as well.

http://support.sas.com/kb/24/447.html 
 

 

 

View solution in original post


All Replies
SAS Super FREQ
Posts: 4,242

Re: [proc glm] contrast is not estimable

The SAS/STAT documentation contains a section that discusses estimability and shows examples. If you change your MODEL statement to 

model y=x1 x2 x1*x2 / solution XPX;

then you can see the X`X matrix and the parameter estimates for your model.

Solution
‎05-06-2018 06:37 PM
SAS Employee
Posts: 97

Re: [proc glm] contrast is not estimable

I would also suggest adding the E option to the ESTIMATE which will match the coefficients of the L vector up with their respective parameters. 

contrast 'linear trend1' x1 -2 0 2 x1*x2 -1 0 1 -1 0 1/e;

When you do that for this example you will notice that you are applying coefficients in the interaction to parameters where x1=2.

 

You need to have the interaction coefficients match up with the levels in the main effect.  Something like this would be estimable:

contrast 'linear trend1' x1 -2 0 2 x1*x2 -1 -1 0 0 1 1/e;

 

But you would need to decide if this is actually what you want.

 

To understand the logic of CONTRAST/ESTIMATE statements, I would (in addition to what Rick suggested) add these examples as well.

http://support.sas.com/kb/24/447.html 
 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 195 views
  • 0 likes
  • 3 in conversation