Basic Models

/*--------------------------------------------------------------

                    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<pzero then y_p=0;
          output;
       end;
    keep y_p x1-x7 z1-z3;
    run;

 option set=GRIDHOST="&GRIDHOST";
 option set=GRIDINSTALLLOC="&GRIDINSTALLLOC";

 proc hpcountreg data=simulate dist=zip;
    performance nthreads=2 nodes=1 details
            host="&GRIDHOST" install="&GRIDINSTALLLOC";
    model y_p=x1-x7;
    zeromodel y_p ~ z1-z3;
 run;


 proc hpcountreg data=simulate dist=zip;
    performance nthreads=8 nodes=10 details
                host="&GRIDHOST" install="&GRIDINSTALLLOC";
    model y_p=x1-x7;
    zeromodel y_p ~ z1-z3;
 run;