09-20-2012 04:27 PM
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.
09-24-2012 04:00 PM
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 / ;
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
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.
09-25-2012 07:59 AM
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.