BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kelSAS
Obsidian | Level 7
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. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

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

2 REPLIES 2
Rick_SAS
SAS Super FREQ

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.

SAS_Rob
SAS Employee

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 
 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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