/*-------------------------------------------------------------- SAS Sample Library Name: hpcnte01.sas Description: Example program from SAS/HPA User's Guide, The HPCOUNTREG Procedure Title: Basic Models Product: SAS/HPA Software Keys: count data analysis PROC: HPCOUNTREG Notes: --------------------------------------------------------------*/ data simulate; call streaminit(12345); array vars x1-x7; array zero_vars z1-z3; array parms{7} (.3 .4 .2 .4 -.3 -.5 -.3); array zero_parms{3} (-.6 .3 .2); intercept=2; z_intercept=-1; theta=0.5; do i=1 to 1000000; sum_xb=0; sum_gz=0; do j=1 to 7; vars[j]=rand('NORMAL',0,1); sum_xb=sum_xb+parms[j]*vars[j]; end; mu=exp(intercept+sum_xb); y_p=rand('POISSON', mu); do j=1 to 3; zero_vars[j]=rand('NORMAL',0,1); sum_gz = sum_gz+zero_parms[j]*zero_vars[j]; end; z_gamma = z_intercept+sum_gz; pzero = cdf('LOGISTIC',z_gamma); cut=rand('UNIFORM'); if cut