Yet Another Blog in Statistical Computing

I can calculate the motion of heavenly bodies but not the madness of people. -Isaac Newton

Marginal Effects in Tobit Models

proc qlim data = data.sme;
  model y = x1 - x7;
  endogenous y ~ censored(lb = 0 ub = 1);
  output out = out1 marginal;
run;
/*
                                 Standard                 Approx
Parameter        Estimate           Error    t Value    Pr > |t|
Intercept       -2.204123        0.118473     -18.60      <.0001
x1              -0.015086        0.008345      -1.81      0.0707
x2               0.376830        0.048772       7.73      <.0001
x3               0.141672        0.008032      17.64      <.0001
x4              -0.813496        0.133564      -6.09      <.0001
x5            0.000036437        0.000320       0.11      0.9094
x6              -0.001152        0.000704      -1.64      0.1016
x7              -0.392152        0.060902      -6.44      <.0001
_Sigma           0.497938        0.012319      40.42      <.0001
*/

proc means data = out1 mean;
  var meff_x:;
run;
/* Auto Calculation:
Variable    Label                                 Mean
------------------------------------------------------
Meff_x1     Marginal effect of x1 on y      -0.0036988
Meff_x2     Marginal effect of x2 on y       0.0923919
Meff_x3     Marginal effect of x3 on y       0.0347354
Meff_x4     Marginal effect of x4 on y      -0.1994545
Meff_x5     Marginal effect of x5 on y    8.9337756E-6
Meff_x6     Marginal effect of x6 on y    -0.000282493
Meff_x7     Marginal effect of x7 on y      -0.0961485
*/

data one;
  set data.sme;
  
  _xb_ = -2.204123 + x1 * -0.015086 + x2 * 0.376830 + x3 * 0.141672 + x4 * -0.813496 + 
         x5 * 0.000036437 + x6 * -0.001152 + x7 * -0.392152;
  _phi_lb = probnorm((0 - _xb_) / 0.497938);
  _phi_ub = probnorm((1 - _xb_) / 0.497938);
  _pdf_lb = pdf('normal', (0 - _xb_) / 0.497938);
  _pdf_ub = pdf('normal', (1 - _xb_) / 0.497938);
  _imr = (_pdf_lb - _pdf_ub) / (_phi_ub - _phi_lb);
  _margin_x1 = (_phi_ub - _phi_lb) * -0.015086;
  _margin_x2 = (_phi_ub - _phi_lb) * 0.376830;
  _margin_x3 = (_phi_ub - _phi_lb) * 0.141672;
  _margin_x4 = (_phi_ub - _phi_lb) * -0.813496;
  _margin_x5 = (_phi_ub - _phi_lb) * 0.000036437;
  _margin_x6 = (_phi_ub - _phi_lb) * -0.001152;
  _margin_x7 = (_phi_ub - _phi_lb) * -0.392152;
run;

proc means data = one mean;
  var _margin_x:;
run; 
/* Manual Calculation:
Variable              Mean
--------------------------
_margin_x1      -0.0036988
_margin_x2       0.0923924
_margin_x3       0.0347356
_margin_x4      -0.1994555
_margin_x5    8.9337391E-6
_margin_x6    -0.000282451
_margin_x7      -0.0961491
*/
Advertisements

Written by statcompute

October 6, 2012 at 3:13 pm

%d bloggers like this: