BookmarkSubscribeRSS Feed
n6
Quartz | Level 8 n6
Quartz | Level 8

Suppose you have these two statements

Estimate 'X'  x  1  -1;

Contrast 'X'  x  1  -1;

I was under the impression that they would always give the exact same results.  I know Estimate and Contrast can do different things, but I thought in the simple case above they'd give the exact same results.  I'm getting different results.  The list of numbers in my statements is longer than just 1 -1, but I write an Estimate line, copy it and change nothing except change "Estimate" to "Contrast," run the model and the results for Estimate are different than the results for Contrast.  This is kinda scary since if you do either Contrast or Estimate you assume it's right, but when you do them both and get different results then you know one of them must be wrong.  Any input is greatly appreciated.

3 REPLIES 3
SteveDenham
Jade | Level 19

Could you post an example?  I am at a loss to explain this, but some code and output might help.

Steve Denham

n6
Quartz | Level 8 n6
Quartz | Level 8

It would probably be better if there was a way to actually attach SAS code and output, and maybe there is, but since I don't know it I'll just type this in.

Here is the code:

proc genmod data=ds_name;

   where x = 10;

   class ID Varname;

   model response = varname / noint dist=poisson covb;

   repeated subject=ID / ar(1);

   contrast 'Contrast Label' Varname 1 -1 0 0 0 0 0 0 0;

   estimate 'Estimate Label' Varname 1 -1 0 0 0 0 0 0 0;

   lsmeans Varname / ;

run;

Here is the output:

                                    Contrast Estimate Results

               Mean          Mean        L'Beta   Standard              L'Beta          Chi-

Label   Estimate   Conf Limits   Estimate   Error   Alpha   Conf Limits   Square   P > Chi-Square

Label     0.28        0.03    2.27     -1.27      1.06     0.05     -3.36   0.82    1.42             0.23

                                  Contrast Results for GEE Analysis

                                     Chi-

Contrast        DF        Square     Pr > Chi-Square       Type

Label              1            0.71              0.40                  Score

Hopefully that's readable.  I cut off some decimal places and did other abbreviations to make it fit, but the general gist is the same.

Re. the code, I don't see how the "WHERE" statement can matter but I included it anyway.  I get the same results regardless of whether I include "NOINT."  (I mean, I get the same results as above, but the parameter estimate of course do change.)  I don't see how any of the other stuff can matter.  The fact that the contrast output indicates it's a Score statistic and the estimate output doesn't say anything about that makes me think they could be doing two different things but still, as I said before, I thought under these circumstances they were doing the same thing.

SteveDenham
Jade | Level 19

Well, one check would be to explore the LSMEANS and LSMESTIMATE statement (if this is available in your version).

If your LSMEANS statement was: lsmeans varname/diff ilink; you could compare the results for the first comparison to each of the two methods.  See which corresponds.

Went to the documentation--way down in the Details section is a part on Generalized Score Statistics under GEE models.  It looks like the contrast statement is using the quadratic form reported there, while the estimate statement uses the standard quadratic form to get the chi-square values. Also, in the documentation for the CONTRAST statement, it says "If you omit the WALD option, the test statistic computed depends on whether an ordinary generalized linear model or a GEE-type model is specified."  And there is the difference--the ESTIMATE statement always produces a Wald chi-square, while the CONTRAST statement picks based on the type of model.  So now you have to determine which is appropriate.  My money is on the generalized score statistic, since under GEE you should accommodate the covariance error structure, and it appears (at least to me) that this is not necessarily the case for the ESTIMATE statement.

Steve Denham

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 3380 views
  • 0 likes
  • 2 in conversation