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?
See this note that shows how to estimate distribution parameters for use in DATA step functions, including the negative binomial.
@Rick_SAS might know how to do this.
See this note that shows how to estimate distribution parameters for use in DATA step functions, including the negative binomial.
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!
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.