BookmarkSubscribeRSS Feed
Sandman2022
Calcite | Level 5

Hi,

I conducted a three-factorial [ pH (2 levels), salt(3 levels), and iron (3 levels)  in a completely randomized design conducted with 3 replications. I want to do an orthogonal test on the second and third levels of iron at the first levels of pH and salt in SAS. However, I get the message   NOTE: CONTRAST one is not estimable. Could you please tell me where I am making mistake?

 

Data factorial;

input     ph salt iron rep yield;

cards;

1              1              1              1              3.5

1              1              1              2              3.8

1              1              1              3              3.4

1              1              2              1              4.1

1              1              2              2              4.3

1              1              2              3              4.5

1              1              3              1              4.6

1              1              3              2              4.8

1              1              3              3              4.9

1              2              1              1              3.1

1              2              1              2              3.2

1              2              1              3              3

1              2              2              1              3.4

1              2              2              2              3.5

1              2              2              3              3.3

1              2              3              1              3.5

1              2              3              2              3.8

1              2              3              3              4

1              3              1              1              3

1              3              1              2              2.98

1              3              1              3              2.8

1              3              2              1              3.1

1              3              2              2              3.5

1              3              2              3              3.2

1              3              3              1              3.6

1              3              3              2              4.1

1              3              3              3              3.4

2              1              1              1              3.2

2              1              1              2              3.4

2              1              1              3              3.1

2              1              2              1              4.1

2              1              2              2              4

2              1              2              3              4.2

2              1              3              1              4.3

2              1              3              2              4.5

2              1              3              3              4.3

2              2              1              1              2.98

2              2              1              2              2.8

2              2              1              3              2.7

2              2              2              1              3.2

2              2              2              2              3.1

2              2              2              3              3.3

2              2              3              1              3

2              2              3              2              3.4

2              2              3              3              3.6

2              3              1              1              2.65

2              3              1              2              2.75

2              3              1              3              2.5

2              3              2              1              3

2              3              2              2              2.98

2              3              2              3              2.95

2              3              3              1              3.2

2              3              3              2              3.5

2              3              3              3              3.1

;

proc glm;

class       ph salt iron rep;

model yield=ph salt iron ph*salt ph*iron salt*iron ph*salt*iron/ss3;

contrast 'one' iron 0 1 -1

               ph*salt*iron 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0/e; 

run;

 

 

4 REPLIES 4
StatDave
SAS Super FREQ

I assume you are trying to compare the levels if IRON in each (or specific) combinations of the levels of SALT and PH. Any time you want to make simple comparisons like this, I strongly advise you to use the LSMEANS, SLICE, or LSMESTIMATE statement which do not require specifying coefficients which are easy to get wrong. I suggest you first run the LSMEANS statement to see the order of the estimated LS-means.

lsmeans ph*salt*iron;

Then you can use the LSMESTIMATE or SLICE statement to make the comparison. However, PROC GLM doesn't allow those statements, so you can fit the same model in PROC ORTHOREG instead. Since the results from the LSMEANS statement shows that the first three LS-means are for the three IRON levels in SALT=PH=1, you could use this statement to compare the IRON=2 and 3 levels in that setting of SALT and PH:

lsmestimate ph*salt*iron 0 1 -1 / e ;

The E option shows you the coefficients on the model parameters that were used in to make the comparison. They are the coefficients that would be used in a CONTRAST or ESTIMATE statement. Or you could use the SLICE statement:

slice ph*salt*iron / sliceby=ph*salt diff e;
PaigeMiller
Diamond | Level 26

Agreeing with @StatDave that CONTRAST statement is not the way to go here; LSMEANS, SLICE or LSMESTIMATE is the way to do this.

 

However, those won't work in certain cases (and also CONSTRAST will not work in those same cases) and you will get "not estimable" usually because at least one of the cells of the interaction has no data in it. I think that's your problem.

--
Paige Miller
SteveDenham
Jade | Level 19

 

This time I will disagree with @PaigeMiller (very rare indeed) .  I ran a PROC FREQ on the data you presented and did not see any empty cells.  So while missing cell(s) can lead to the problem, I don't think that is what you are facing.  It is the construction of your CONTRAST statement, which can be avoided using LSMEANS with the slice= option ( @StatDave 's solution)..

 

SteveDenham

DWilson
Pyrite | Level 9

I don't see an issue with your contrast statement aside from the fact that it is not estimable.

 

The issue appears to be that your contrast is not estimable because there are no combinations of the rows of your model's X matrix that produce the contrast vector you want. In other words, the beta coefficients in your contrast vector that have non-zeroes cannot be estimated jointly. 

 

If you want to compare the mean yield by levels of iron then using something like:

lsmeans /pdiff;

 

will do that.

 

Just be aware that LSMEANS is an average effect (the terms in the underlying contrast vector applied to the model beta coefficients are, basically, proportions calculated using all 54 records.)

The SLICE statement would let you estimate (a population average effect) of the yield by iron levels for some specified values of the terms with which IRON is interacted.

 

 

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 805 views
  • 5 likes
  • 5 in conversation