Programming the statistical procedures from SAS

Genmod contrast statement for zero-inflated poisson model

Reply
New Contributor
Posts: 2

Genmod contrast statement for zero-inflated poisson model

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.

 

 

 

 
SAS Employee
Posts: 97

Re: Genmod contrast statement for zero-inflated poisson model

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;

 

New Contributor
Posts: 2

Re: Genmod contrast statement for zero-inflated poisson model

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.

SAS Employee
Posts: 385

Re: Genmod contrast statement for zero-inflated poisson model

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.

Ask a Question
Discussion stats
  • 3 replies
  • 88 views
  • 0 likes
  • 3 in conversation