Help using Base SAS procedures

Including zero-count cells to the GENMOD (multinomial.dist) procedure?

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Including zero-count cells to the GENMOD (multinomial.dist) procedure?

I have a data as below syntax, when I run this analysis the program does not include zero-count cells, so the contrasts among the "site"s (site is one of the input in my data as you may see below) are not realistic. Is there anyway to include zero-counts to the analysis? If it is possible I prefer to add some additional syntax to the below?

 

data plant;

input site $ leaf $ count;

datalines;

Fa nh 21

Fa sh 0

Fa h 5

Green nh 0

Green sh 0

Green h 16

Ice nh 4

Ice sh 0

Ice h 4

NFM nh 6

NFM sh 13

NFM h 47

NFRB nh 7

NFRB sh 0

NFRB h 15

SF nh 11

SF sh 13

SF h 19

SpM nh 15

SpM sh 2

SpM h 2

SpX nh 8

SpX sh 1

SpX h 0

SW nh 19

SW sh 0

SW h 1

;

proc genmod data=plant rorder=data;

freq count;

class site;

model leaf=site / dist=multinomial link=cumlogit aggregate=site type3;

estimate 'LogORFaGreen' site 1 -1 0 0 0 0 0 0 0 / exp;

estimate 'LogORFaIce' site 1 0 -1 0 0 0 0 0 0 / exp;

estimate 'LogORFaNFM' site 1 0 0 -1 0 0 0 0 0 / exp;

estimate 'LogORFaNFRB' site 1 0 0 0 -1 0 0 0 0 / exp;

estimate 'LogORFaSF' site 1 0 0 0 0 -1 0 0 0 / exp;

estimate 'LogORFaSW' site 1 0 0 0 0 0 -1 0 0 / exp;

estimate 'LogORFaSpM' site 1 0 0 0 0 0 0 -1 0 / exp;

estimate 'LogORFaSpX' site 1 0 0 0 0 0 0 0 -1 / exp;

estimate 'LogORGreenIce' site 0 1 -1 0 0 0 0 0 0 / exp;

estimate 'LogORGreenNFM' site 0 1 0 -1 0 0 0 0 0 / exp;

estimate 'LogORGreenNFRB' site 0 1 0 0 -1 0 0 0 0 / exp;

estimate 'LogORGreenSF' site 0 1 0 0 0 -1 0 0 0 / exp;

estimate 'LogORGreenSW' site 0 1 0 0 0 0 -1 0 0 / exp;

estimate 'LogORGreenSpM' site 0 1 0 0 0 0 0 -1 0 / exp;

estimate 'LogORGreenSpX' site 0 1 0 0 0 0 0 0 -1 / exp;

estimate 'LogORIceNFM' site 0 0 1 -1 0 0 0 0 0 / exp;

estimate 'LogORIceNFRB' site 0 0 1 0 -1 0 0 0 0 / exp;

estimate 'LogORIceSF' site 0 0 1 0 0 -1 0 0 0 / exp;

estimate 'LogORIceSW' site 0 0 1 0 0 0 -1 0 0 / exp;

estimate 'LogORIceSpM' site 0 0 1 0 0 0 0 -1 0 / exp;

estimate 'LogORIceSpX' site 0 0 1 0 0 0 0 0 -1 / exp;

estimate 'LogORNFMNFRB' site 0 0 0 1 -1 0 0 0 0 / exp;

estimate 'LogORNFMSF' site 0 0 0 1 0 -1 0 0 0 / exp;

estimate 'LogORNFMSW' site 0 0 0 1 0 0 -1 0 0 / exp;

estimate 'LogORNFMSpM' site 0 0 0 1 0 0 0 -1 0 / exp;

estimate 'LogORNFMSpX' site 0 0 0 1 0 0 0 0 -1 / exp;

estimate 'LogORNFRBSF' site 0 0 0 0 1 -1 0 0 0 / exp;

estimate 'LogORNFRBSW' site 0 0 0 0 1 0 -1 0 0 / exp;

estimate 'LogORNFRBSpM' site 0 0 0 0 1 0 0 -1 0 / exp;

estimate 'LogORNFRBSpX' site 0 0 0 0 1 0 0 0 -1 / exp;

estimate 'LogORSFSW' site 0 0 0 0 0 1 -1 0 0 / exp;

estimate 'LogORSFSpM' site 0 0 0 0 0 1 0 -1 0 / exp;

estimate 'LogORSFSpX' site 0 0 0 0 0 1 0 0 -1 / exp;

estimate 'LogORSWSpM' site 0 0 0 0 0 0 1 -1 0 / exp;

estimate 'LogORSWSpX' site 0 0 0 0 0 0 1 0 -1 / exp;

estimate 'LogORSpMSpX' site 0 0 0 0 0 0 0 1 -1 / exp;

run;


Accepted Solutions
Solution
‎07-13-2016 12:50 PM
Super User
Posts: 10,028

Re: Including zero-count cells to the GENMOD (multinomial.dist) procedure?

Posted in reply to SerdarFin

Now, I know what kind of model you want to build. You are trying build cumulative Logistic Regression, 
But ZERO here means nothing for Logistic Model. Maybe you should start to consider other Model Like Zero-Inflated Poission Model.

View solution in original post


All Replies
Super User
Posts: 10,028

Re: Including zero-count cells to the GENMOD (multinomial.dist) procedure?

Posted in reply to SerdarFin

What kind of model are you trying to build ? LOGISTIC or Zero Inflated Possion Regression ?
I can't believe why documentation didn't include an example for ZIP .


Zero Inflated Possion :  


 
data plant;
input site $ leaf $ count;
datalines;
Fa nh 21
Fa sh 0
Fa h 5
Green nh 0
Green sh 0
Green h 16
Ice nh 4
Ice sh 0
Ice h 4
NFM nh 6
NFM sh 13
NFM h 47
NFRB nh 7
NFRB sh 0
NFRB h 15
SF nh 11
SF sh 13
SF h 19
SpM nh 15
SpM sh 2
SpM h 2
SpX nh 8
SpX sh 1
SpX h 0
SW nh 19
SW sh 0
SW h 1
;
proc genmod data=plant ;
class leaf site;
model count=leaf site / dist=zip type3;
zeromodel site/link=logit;
estimate 'LogORFaGreen' site 1 -1 0 0 0 0 0 0 0 / exp;
run;


New Contributor
Posts: 2

Re: Including zero-count cells to the GENMOD (multinomial.dist) procedure?

no attachments. -##
Hi,
Thanks for the reply.
But "count" should be Frequency Weight Variable of "leaf", sp "leaf" should be response, model leaf=site. I try it but this doesnt work. Which I tried as below considering your solution, may I ask to check and if possible adjust the model statement below: Iadded "freq count" to the syntax but it didnt work?

data plant;
input site $ leaf $ count;
datalines;
Fa nh 21
Fa sh 0
Fa h 5
Green nh 0
Green sh 0
Green h 16
Ice nh 4
Ice sh 0
Ice h 4
NFM nh 6
NFM sh 13
NFM h 47
NFRB nh 7
NFRB sh 0
NFRB h 15
SF nh 11
SF sh 13
SF h 19
SpM nh 15
SpM sh 2
SpM h 2
SpX nh 8
SpX sh 1
SpX h 0
SW nh 19
SW sh 0
SW h 1
;
proc genmod data=plant ;
freq count;
class site;
model leaf=site / dist=zip type3;
zeromodel site/link=logit;
estimate 'LogORFaGreen' site 1 -1 0 0 0 0 0 0 0 / exp;
run;
Super User
Posts: 10,028

Re: Including zero-count cells to the GENMOD (multinomial.dist) procedure?

Posted in reply to SerdarFin

I am not expert about statistical, Maybe someone could give you some good advice.
First of all , you need to know what kind of model you want to build . if you want take LEAF as dependent variable which 
have three levels , the model you gave us didn't mean anything for your data . It is more like you want build ANOVA or 
Covariate Analysis ? Check PROC GLM .

Solution
‎07-13-2016 12:50 PM
Super User
Posts: 10,028

Re: Including zero-count cells to the GENMOD (multinomial.dist) procedure?

Posted in reply to SerdarFin

Now, I know what kind of model you want to build. You are trying build cumulative Logistic Regression, 
But ZERO here means nothing for Logistic Model. Maybe you should start to consider other Model Like Zero-Inflated Poission Model.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 232 views
  • 0 likes
  • 2 in conversation