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. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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