Contributor
Posts: 62

# Estimate and Contrast statements in PROC GENMOD

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.

Posts: 2,655

## Re: Estimate and Contrast statements in PROC GENMOD

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

Steve Denham

Contributor
Posts: 62

## Re: Estimate and Contrast statements in PROC GENMOD

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.

Posts: 2,655

## Re: Estimate and Contrast statements in PROC GENMOD

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

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