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:
proc Genmod;
class a b;
model y=a / dist=zip;
zeromodel b;
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.
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?
data insure;
input n c car$ age;
ln = log(n);
datalines;
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;
zeromodel age;
contrast 'c' car 1 -1 @Zero age 1 -1;
run;
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.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.