CNTSELECT Procedure

Example 10.1 Zero-Inflated Poisson Model with CLASS Statement

This example shows how to use the CNTSELECT procedure to estimate a zero-inflated Poisson model with a classification variable Group that has two levels. The following DATA step generates 10,000 replicates from the zero-inflated Poisson (ZIP) model. The first 5,000 replicates belong to the first group, and the second 5,000 replicates belong to the second group. The model contains seven variables and three variables that correspond to the zero-inflated process.

    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=0.5;
       group=1;
       z_intercept=-1;
       theta=0.5;

       do i=1 to 10000;
          sum_xb=0;
          sum_gz=0;
          if i>5000 then do;
             intercept=2;
             group=2;
          end;
          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<pzero then y_p=0;
          output;
       end;
    keep y_p group x1-x7 z1-z3;
    run;

You can load the data set simulate into a data table in your session that is associated with the mylib libref. The DATA step assumes that your libref is named mylib, but you can substitute any appropriately defined libref.

data mylib.simulate;
   set simulate;
run;

The following statements estimate a zero-inflated Poisson model with the classification variable Group:


 proc cntselect data=mylib.simulate dist=zip;
    class group;
    model y_p=group x1-x7;
    zeromodel y_p ~ z1-z3;
 run;

Output 10.1.1 shows the results for the zero-inflated Poisson model.

Output 10.1.1: Zero-Inflated Poisson Model with CLASS Statement

The CNTSELECT Procedure

Class Level Information
ClassLevelsValues
group21 2

Model Fit Summary
Dependent Variabley_p
Number of Observations10000
Data SetSIMULATE
ModelZIP
ZI Link FunctionLogistic
Log Likelihood-18176.3
Maximum Absolute Gradient0.001931
Number of Iterations7
Optimization MethodNewton-Raphson
AIC36378.62
SBC36472.35
Covariance EstimationHessian

Convergence criterion (FCONV=1E-8) satisfied.

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept12.0012860.006746296.67<.0001
group 11-1.4919030.012383-120.48<.0001
group 200...
x110.2966330.00462864.09<.0001
x210.4006430.00460786.96<.0001
x310.1962780.00459242.74<.0001
x410.3949710.00464485.05<.0001
x51-0.2997760.004508-66.50<.0001
x61-0.4975700.004809-103.47<.0001
x71-0.2957550.004510-65.57<.0001
Inf_Intercept1-0.9692110.028573-33.92<.0001
Inf_z11-0.6094920.029128-20.92<.0001
Inf_z210.2985720.02703911.04<.0001
Inf_z310.2080620.0265577.83<.0001


The "Class Level Information" table shows that the classification variable Group has two levels. The "Model Fit Summary" table shows detailed information about the model and indicates that all 10,000 observations were used to fit the model. All parameter estimates in the "Parameter Estimates" table are highly significant and correspond to their theoretical values set during the data generating process.

Last updated: July 09, 2026