Resources

Types of Tobit Model

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

                    SAS Sample Library

        Name: qliex06.sas
 Description: Example program from SAS/ETS User's Guide,
              The QLIM Procedure
       Title: Types of Tobit Model
     Product: SAS/ETS Software
        Keys: limited dependent variables
        PROC: QLIM
       Notes:

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

data a1;
   keep y x;
   do i = 1 to 500;
      x = rannor( 19283 );
      u = rannor( 19283 );
      yl = 1 + 2 * x + u;
      if ( yl > 0 ) then y = yl;
      else                y = 0;
      output;
   end;
run;

/*-- Type 1 Tobit --*/
proc qlim data=a1 method=qn;
   model y = x;
   endogenous y ~ censored(lb=0);
run;

data a2;
   keep y1 y2 x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      y1l = 1 + 2 * x1 + 3 * x2 + u1;
      y2l = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      if ( y1l > 0 ) then y1 = 1;
      else                y1 = 0;
      if ( y1l > 0 ) then y2 = y2l;
      else                y2 = 0;
      output;
   end;
run;

/*-- Type 2 Tobit --*/
proc qlim data=a2 method=qn;
   model y1 = x1 x2 / discrete;
   model y2 = x1 x2 / select(y1=1);
run;

data a3;
   keep y1 y2 x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      y1l = 1 + 2 * x1 + 3 * x2 + u1;
      y2l = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      if ( y1l > 0 ) then y1 = y1l;
      else                y1 = 0;
      if ( y1l > 0 ) then y2 = y2l;
      else                y2 = 0;
      output;
   end;
run;

/*-- Type 3 Tobit --*/
proc qlim data=a3 method=qn;
   model y1 = x1 x2 / censored(lb=0);
   model y2 = x1 x2 / select(y1>0);
run;

data a4;
   keep y1 y2 y3 x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      u3 = rannor( 19283 );
      y1l = 1 + 2 * x1 + 3 * x2 + u1;
      y2l = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      y3l = 0 - 1 * x1 + 1 * x2 + u1*.1 - u2*.5 + u3*.5;
      if ( y1l > 0 ) then y1 = y1l;
      else                y1 = 0;
      if ( y1l > 0 ) then y2 = y2l;
      else                y2 = 0;
      if ( y1l <= 0 ) then y3 = y3l;
      else                y3 = 0;
      output;
   end;
run;

/*-- Type 4 Tobit --*/
proc qlim data=a4 method=qn;
   model y1 = x1 x2 / censored(lb=0);
   model y2 = x1 x2 / select(y1>0);
   model y3 = x1 x2 / select(y1<=0);
run;

data a5;
   keep y1 y2 y3 x1 x2;
   do i = 1 to 500;
      x1 = rannor( 19283 );
      x2 = rannor( 19283 );
      u1 = rannor( 19283 );
      u2 = rannor( 19283 );
      u3 = rannor( 19283 );
      y1l = 1 + 2 * x1 + 3 * x2 + u1;
      y2l = 3 + 4 * x1 - 2 * x2 + u1*.2 + u2;
      y3l = 0 - 1 * x1 + 1 * x2 + u1*.1 - u2*.5 + u3*.5;
      if ( y1l > 0 ) then y1 = 1;
      else                y1 = 0;
      if ( y1l > 0 ) then y2 = y2l;
      else                y2 = 0;
      if ( y1l <= 0 ) then y3 = y3l;
      else                y3 = 0;
      output;
   end;
run;

/*-- Type 5 Tobit --*/
proc qlim data=a5 method=qn;
   model y1 = x1 x2 / discrete;
   model y2 = x1 x2 / select(y1>0);
   model y3 = x1 x2 / select(y1<=0);
run;