Programming the statistical procedures from SAS

proc genmond and proc nlmixed give the different results for ZIP

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

proc genmond and proc nlmixed give the different results for ZIP

[ Edited ]

 

I'm running the following two codes on the attached data and getting two different results. Moreover the results for the Zero inflation do not appear correct. I don't know whether it is a problem with some code or It's a sign that zero inflation is not the best for this data! because even the significance of the Zero inflation estimates is way off from proc nlmixed

 

 

proc genmod data = bbbb;
  model y_c = x1 x2/dist=zip;
  zeromodel x1 x2 /link = logit;
run;

/*********************************************************************************************************/

proc nlmixed data=bbbb;
   parameters b0=0 b1=0 b2=0 
              a0=0 a1 = 0 a2=0 ;
   linpinfl = a0 + a1*x1 + a2*x2;
  infprob  = 1/(1+exp(-linpinfl));
   lambda   = exp(b0 + b1*x1 + b2*x2 );
   if y_c=0 then 
        ll = log(infprob + (1-infprob)*exp(-lambda));
   else ll = log((1-infprob)) - lambda  + y_c*log(lambda) - lgamma(y_c + 1);
   model y_c ~ general(ll);
run;

Accepted Solutions
Solution
‎03-18-2018 04:24 AM
SAS Super FREQ
Posts: 4,240

Re: proc genmond and proc nlmixed give the different results for ZIP

I suggest you simulate data that matches the model. You will then know the true values of the parameters and you can assess which method performs as expected. Simulation enables you to generate a large data set (such as 10,000 observations) so that the standard errors for the statistics are very small.

View solution in original post


All Replies
Solution
‎03-18-2018 04:24 AM
SAS Super FREQ
Posts: 4,240

Re: proc genmond and proc nlmixed give the different results for ZIP

I suggest you simulate data that matches the model. You will then know the true values of the parameters and you can assess which method performs as expected. Simulation enables you to generate a large data set (such as 10,000 observations) so that the standard errors for the statistics are very small.

Contributor
Posts: 20

Re: proc genmond and proc nlmixed give the different results for ZIP

Thanks a lot for this idea! I noticed the problem! I messed up the data unknowingly and I didn't realize that I had deleted all the observations with the Zero counts.

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 144 views
  • 0 likes
  • 2 in conversation