06-06-2018 01:21 PM
Using Genmod, I am estimating a zero-inflated Poisson model. I want to test a contrast involving covariates that appear only in the Zeromodel statement. There should be no problem doing so since this example appears in the SAS 9.4 documentation:
class a b;
model y=a / dist=zip;
contrast 'Label2' A 1 -1 @Zero B 1 -1;
As you can see, there is no overlap in this model between the covariates in the Model statement and those in the Zeromodel statement, and the requested Contrast involves covariates in both those statements. But when I try to do something exactly like the example code above, I get this error message:
"ERROR: Effects used in the CONTRAST statement must have appeared previously in the MODEL statement."
Any suggestions would be appreciated. I am baffled.
06-06-2018 02:51 PM
In general that code should work. Are there any other messages in the LOG? Without seeing the actual code/log my only guess is that you might have put DIST=POISSON rather than DIST=ZIP.
What happens when you run the following?
input n c car$ age;
ln = log(n);
500 42 small 1
1200 37 medium 1
100 1 large 1
400 101 small 2
500 73 medium 2
300 14 large 2
proc genmod data=insure;
class car age;
model c = car / dist = zip
offset = ln;
contrast 'c' car 1 -1 @Zero age 1 -1;
06-07-2018 09:22 AM
06-06-2018 03:44 PM
Also, note that the CONTRAST and ESTIMATE statements estimate the components of the contrast separately for the mean and zero-inflated models. If your goal is ultimately to make mean comparisons, see this note.