QLIM Procedure

Example 27.5 Sample Selection Model with Truncation and Censoring

(View the complete code for this example.)

In this example the data are generated such that the selection variable is discrete and the variable Y is truncated from below by zero. The program follows, with the results shown in Output 27.5.1:

title1 'Estimating a Sample Selection Model with Truncation';

data trunc;
   keep z y x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      zl = 1 + 2 * x1 + 3 * x2 + u1;
      y = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      if ( zl > 0 ) then z = 1;
      else z = 0;
      if y>=0 then output;
   end;
run;
/*-- Sample Selection with Truncation --*/
proc qlim data=trunc method=qn;
   model z = x1 x2 / discrete;
   model y = x1 x2 / select(z=1) truncated(lb=0);
run;

Output 27.5.1: Sample Selection with Truncation

Estimating a Sample Selection Model with Truncation

The QLIM Procedure

Model Fit Summary
Number of Endogenous Variables2
Endogenous Variablez y
Number of Observations379
Log Likelihood-344.10722
Maximum Absolute Gradient4.95942E-6
Number of Iterations17
Optimization MethodQuasi-Newton
AIC704.21444
Schwarz Criterion735.71473

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
y.Intercept13.0141580.12854823.45<.0001
y.x113.9956710.09959940.12<.0001
y.x21-1.9726970.096385-20.47<.0001
_Sigma.y10.9234280.04723319.55<.0001
z.Intercept10.9494440.1902654.99<.0001
z.x112.1639280.2883847.50<.0001
z.x213.1342130.3792518.26<.0001
_Rho10.4943560.1765422.800.0051


In the following statements the data are generated such that the selection variable is discrete and the variable Y is censored from below by zero. The results are shown in Output 27.5.2.

title1 'Estimating a Sample Selection Model with Censoring';

data cens;
   keep z y x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      zl = 1 + 2 * x1 + 3 * x2 + u1;
      yl = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      if ( zl > 0 ) then z = 1;
      else               z = 0;
      if ( yl > 0 ) then y = yl;
      else               y = 0;
      output;
   end;
run;
/*-- Sample Selection with Censoring --*/
proc qlim data=cens method=qn;
   model z = x1 x2 / discrete;
   model y = x1 x2 / select(z=1) censored(lb=0);
run;

Output 27.5.2: Sample Selection with Censoring

Estimating a Sample Selection Model with Censoring

The QLIM Procedure

Model Fit Summary
Number of Endogenous Variables2
Endogenous Variablez y
Number of Observations500
Log Likelihood-399.78508
Maximum Absolute Gradient2.30443E-6
Number of Iterations19
Optimization MethodQuasi-Newton
AIC815.57015
Schwarz Criterion849.28702

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
y.Intercept13.0742760.11161727.54<.0001
y.x113.9636190.08579646.20<.0001
y.x21-2.0235480.088714-22.81<.0001
_Sigma.y10.9208600.04327821.28<.0001
z.Intercept11.0136100.1540816.58<.0001
z.x112.2569220.2559998.82<.0001
z.x213.3026920.3421689.65<.0001
_Rho10.3507760.1970931.780.0751


Last updated: June 19, 2025