BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RobertWF1
Quartz | Level 8

I've recently fit a zero-inflated negative binomial distribution to hospital inpatient visit data using proc genmod:

 

 

ods trace on;
proc genmod data = IP_count_data;
  	model Y = / dist=zinb;
  	zeromodel;
	output out=ZINBFit p=p pzero=pzero;
	ods output ZeroParameterEstimates = ZeroParameterEstimates; 
	ods output ParameterEstimates = ParameterEstimates;
run;

I'd like to randomly generate observations Y from this same zero-inflated negative binomial distribution. This can be done using the following expression, pulled from an earlier question in the forum:

 

 

 

Y_simulated = rand('BERNOULLI', 1-pzero)*rand('NEGBINOMIAL', k, p);

I can use the pzero = zero inflation probability parameter generated from proc genmod. 

 

However, proc genmod does not produce the parameters k (= # of successes) and p (probability of success) which are necessary in the rand('NEGBINOMIAL', k, p) function. Can k and p be manually calculated from the proc genmod output?

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

See this note that shows how to estimate distribution parameters for use in DATA step functions, including the negative binomial. 

View solution in original post

4 REPLIES 4
StatDave
SAS Super FREQ

See this note that shows how to estimate distribution parameters for use in DATA step functions, including the negative binomial. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 824 views
  • 5 likes
  • 3 in conversation