BookmarkSubscribeRSS Feed
nwilcox
Calcite | Level 5

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.

 

 

 

 
3 REPLIES 3
SAS_Rob
SAS Employee

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;

 

nwilcox
Calcite | Level 5

Thanks for your help. I figured out my problem. In my code, the zero model had several separate rows and I had only preceded the first one with @Zero. Preceding every row with @Zero solved the problem. Sorry to bother you guys.

StatDave
SAS Super FREQ

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1284 views
  • 0 likes
  • 3 in conversation