Skip to contents

Fits the classical Heckman sample selection model using Maximum Likelihood Estimation (MLE). Initial parameter estimates are obtained via the two-step method.

Usage

HeckmanCL(selection, outcome, data = sys.frame(sys.parent()), start = NULL)

Arguments

selection

A formula specifying the selection equation.

outcome

A formula specifying the primary outcome equation.

data

A data frame containing the variables in the model.

start

An optional numeric vector of initial parameter values. If not provided, default values are used.

Value

A list containing:

  • coefficients: A named numeric vector of estimated parameters.

  • value: The value of the (negative) log-likelihood at convergence.

  • loglik: The maximized log-likelihood.

  • counts: Number of gradient evaluations performed.

  • hessian: Hessian matrix at the optimum.

  • fisher_infoHC: The (approximate) Fisher information matrix.

  • prop_sigmaHC: Approximate standard errors.

  • level: Levels of the selection variable.

  • nObs: Number of observations.

  • nParam: Number of estimated parameters.

  • N0: Number of unobserved (censored) observations.

  • N1: Number of observed (uncensored) observations.

  • NXS: Number of parameters in the selection equation.

  • NXO: Number of parameters in the outcome equation.

  • df: Degrees of freedom (observations minus parameters).

  • aic: Akaike Information Criterion.

  • bic: Bayesian Information Criterion.

  • initial.value: Initial parameter values used in the optimization.

Details

This function estimates the parameters of the classical Heckman sample selection model via MLE, accounting for potential sample selection bias. It uses the optim function with the BFGS method to find the parameter estimates that maximize the log-likelihood function. The initial values for optimization are obtained using the two-step Heckman method.

The function returns a rich set of results, including:

  • Estimated coefficients for the selection and outcome equations.

  • Standard deviation of the outcome error term (sigma).

  • Correlation between the errors of the selection and outcome equations (rho).

  • Measures of model fit (AIC, BIC).

  • Standard errors (approximated by the square root of the Fisher information diagonal).

References

James J Heckman (1979). “Sample selection bias as a specification error.” Econometrica: Journal of the econometric society, 153–161.

Examples

data(MEPS2001)
attach(MEPS2001)
#> The following objects are masked from MEPS2001 (pos = 3):
#> 
#>     age, age2, agefem, ambexp, blhisp, dambexp, dhospexp, educ,
#>     fairpoor, female, ffs, good, hospexp, income, ins, instype,
#>     instype_s1, lambexp, lnambx, totchr, vgood, year01
#> The following objects are masked from MEPS2001 (pos = 4):
#> 
#>     age, age2, agefem, ambexp, blhisp, dambexp, dhospexp, educ,
#>     fairpoor, female, ffs, good, hospexp, income, ins, instype,
#>     instype_s1, lambexp, lnambx, totchr, vgood, year01
selectEq <- dambexp ~ age + female + educ + blhisp + totchr + ins + income
outcomeEq <- lnambx ~ age + female + educ + blhisp + totchr + ins
HeckmanCL(selectEq, outcomeEq, data = MEPS2001)
#> Start not provided using default start values.
#> $coefficients
#>  (Intercept)          age       female         educ       blhisp       totchr 
#> -0.675795875  0.087906871  0.662658055  0.061937318 -0.363964274  0.796955755 
#>          ins       income  (Intercept)          age       female         educ 
#>  0.170142971  0.002708489  5.044231877  0.211960085  0.348121687  0.018709407 
#>       blhisp       totchr          ins        sigma          rho 
#> -0.218575569  0.539920985 -0.029993139  1.271018191 -0.130612736 
#> 
#> $value
#> [1] -5836.219
#> 
#> $loglik
#> [1] -5836.219
#> 
#> $counts
#> gradient 
#>       62 
#> 
#> $hessian
#>                [,1]          [,2]          [,3]          [,4]          [,5]
#>  [1,]  -1195.905825   -4597.86530   -447.186469  -15544.10996 -4.674518e+02
#>  [2,]  -4597.865304  -19140.48412  -1715.633185  -59713.78278 -1.731977e+03
#>  [3,]   -447.186469   -1715.63318   -447.186469   -5839.20435 -1.947309e+02
#>  [4,] -15544.109958  -59713.78278  -5839.204354 -210324.28582 -5.707166e+03
#>  [5,]   -467.451769   -1731.97692   -194.730882   -5707.16627 -4.674518e+02
#>  [6,]   -203.932598    -846.15339    -73.568837   -2581.82452 -7.781770e+01
#>  [7,]   -402.337670   -1656.33768   -132.764527   -5304.93608 -1.416204e+02
#>  [8,] -40618.222063 -162172.25203 -13128.794238 -553590.63289 -1.349779e+04
#>  [9,]    -82.943915    -323.27087    -34.262339   -1091.72912 -2.984656e+01
#> [10,]   -323.270730   -1362.64460   -130.605971   -4251.76537 -1.128907e+02
#> [11,]    -34.262339    -130.60608    -34.262339    -447.11602 -1.448256e+01
#> [12,]  -1091.724832   -4251.74775   -447.112332  -14948.82997 -3.697501e+02
#> [13,]    -29.846564    -112.89070    -14.482564    -369.75041 -2.984656e+01
#> [14,]    -16.773405     -70.28529     -6.016490    -212.26967 -6.304884e+00
#> [15,]    -28.904076    -118.62313    -10.624417    -386.61871 -9.913931e+00
#> [16,]     -4.938198     -22.40414     -3.161299     -70.62511 -9.991159e-01
#> [17,]    -36.226998    -146.99831     -6.985817    -458.38464 -1.907413e+01
#>               [,6]          [,7]          [,8]         [,9]        [,10]
#>  [1,]  -203.932598   -402.337670   -40618.2221    -82.94392   -323.27073
#>  [2,]  -846.153394  -1656.337676  -162172.2520   -323.27087  -1362.64460
#>  [3,]   -73.568837   -132.764527   -13128.7942    -34.26234   -130.60597
#>  [4,] -2581.824520  -5304.936084  -553590.6329  -1091.72912  -4251.76537
#>  [5,]   -77.817697   -141.620426   -13497.7932    -29.84656   -112.89069
#>  [6,]  -236.705428    -59.413222    -6706.3811    -16.77341    -70.28514
#>  [7,]   -59.413222   -402.337670   -15630.9848    -28.90408   -118.62307
#>  [8,] -6706.381089 -15630.984754 -2086232.0028  -2885.11903 -11725.33921
#>  [9,]   -16.773408    -28.904076    -2885.1190  -1742.98474  -7187.34648
#> [10,]   -70.285144   -118.623070   -11725.3392  -7187.34648 -31810.53542
#> [11,]    -6.016491    -10.624417    -1028.8472   -964.22175  -3952.66634
#> [12,]  -212.265448   -386.616768   -39741.9396 -23662.35864 -97654.46181
#> [13,]    -6.304885     -9.913931     -877.0458   -481.56051  -1899.01909
#> [14,]   -19.590042     -5.309898     -567.3374   -967.37661  -4325.05311
#> [15,]    -5.309899    -28.904076    -1140.0708   -656.64301  -2798.71771
#> [16,]    -2.714922     -2.295442     -229.7735     53.11181    202.44593
#> [17,]    -3.703175    -12.195601    -1394.1793   -525.34912  -2007.40888
#>               [,11]        [,12]        [,13]         [,14]        [,15]
#>  [1,]    -34.262339   -1091.7248   -29.846564    -16.773405   -28.904076
#>  [2,]   -130.606085   -4251.7477  -112.890700    -70.285286  -118.623131
#>  [3,]    -34.262339    -447.1123   -14.482564     -6.016490   -10.624417
#>  [4,]   -447.116024  -14948.8300  -369.750413   -212.269671  -386.618710
#>  [5,]    -14.482564    -369.7501   -29.846564     -6.304884    -9.913931
#>  [6,]     -6.016491    -212.2654    -6.304885    -19.590042    -5.309899
#>  [7,]    -10.624417    -386.6168    -9.913931     -5.309898   -28.904076
#>  [8,]  -1028.847172  -39741.9396  -877.045756   -567.337391 -1140.070772
#>  [9,]   -964.221747  -23662.3586  -481.560511   -967.376610  -656.643006
#> [10,]  -3952.666341  -97654.4618 -1899.019090  -4325.053114 -2798.717708
#> [11,]   -964.221747  -13068.0237  -286.232076   -588.676146  -334.737259
#> [12,] -13068.023739 -332253.1107 -6135.228051 -13041.414300 -9013.492843
#> [13,]   -286.232076   -6135.2281  -481.560511   -246.394196  -163.198951
#> [14,]   -588.676146  -13041.4143  -246.394196  -1677.049557  -331.715094
#> [15,]   -334.737259   -9013.4928  -163.198951   -331.715094  -656.643006
#> [16,]     18.586195     685.1003    21.599899      7.448276    17.362075
#> [17,]   -184.775661   -6783.5851  -213.097958    -75.503198  -172.496432
#>               [,16]        [,17]
#>  [1,]    -4.9381982   -36.226998
#>  [2,]   -22.4041389  -146.998314
#>  [3,]    -3.1612989    -6.985817
#>  [4,]   -70.6251065  -458.384641
#>  [5,]    -0.9991159   -19.074126
#>  [6,]    -2.7149223    -3.703175
#>  [7,]    -2.2954416   -12.195601
#>  [8,]  -229.7734710 -1394.179295
#>  [9,]    53.1118053  -525.349118
#> [10,]   202.4459327 -2007.408878
#> [11,]    18.5861946  -184.775661
#> [12,]   685.1002602 -6783.585085
#> [13,]    21.5998989  -213.097958
#> [14,]     7.4482763   -75.503198
#> [15,]    17.3620748  -172.496432
#> [16,] -3471.9641494  -140.866256
#> [17,]  -140.8662561  -302.373669
#> 
#> $fisher_infoHC
#>                [,1]          [,2]          [,3]          [,4]          [,5]
#>  [1,]  3.764735e-02 -2.981593e-03 -6.860856e-04 -1.869132e-03 -4.210178e-03
#>  [2,] -2.981593e-03  7.519042e-04 -7.409563e-05  3.185812e-05  1.495089e-04
#>  [3,] -6.860856e-04 -7.409563e-05  3.713363e-03 -6.268788e-05 -2.462773e-04
#>  [4,] -1.869132e-03  3.185812e-05 -6.268788e-05  1.447047e-04  1.558729e-04
#>  [5,] -4.210178e-03  1.495089e-04 -2.462773e-04  1.558729e-04  3.828353e-03
#>  [6,] -5.774784e-04 -2.405421e-04  7.057135e-05  3.388814e-05  4.716555e-05
#>  [7,] -3.868819e-05 -2.732537e-04  1.904161e-04 -9.987063e-06  6.842619e-05
#>  [8,]  2.842623e-05 -6.512073e-06  1.226685e-05 -5.127908e-06  5.134956e-06
#>  [9,] -2.649333e-03  3.069526e-04 -2.723476e-04  8.681478e-05  5.490042e-04
#> [10,]  1.644227e-04 -4.146015e-05  1.433242e-05  1.548560e-07 -2.220392e-05
#> [11,]  2.109384e-04 -3.650138e-05 -9.437032e-05  3.366305e-06 -7.156665e-05
#> [12,]  1.107352e-04 -4.608261e-06  1.043375e-05 -6.599734e-06 -1.708046e-05
#> [13,]  1.158975e-04  1.552953e-05 -4.412011e-05 -9.490494e-06 -1.580959e-04
#> [14,]  1.076544e-04 -1.654084e-05  6.295897e-05  6.510042e-07 -5.763740e-05
#> [15,]  6.753907e-05 -1.053866e-10  1.108824e-05  1.315014e-06 -3.292956e-05
#> [16,] -3.080428e-05  7.411620e-06 -1.543430e-05 -3.359897e-07  1.518390e-05
#> [17,]  6.970318e-04 -1.629732e-04  2.957542e-04  4.406887e-06 -3.093799e-04
#>                [,6]          [,7]          [,8]          [,9]         [,10]
#>  [1,] -5.774784e-04 -3.868819e-05  2.842623e-05 -2.649333e-03  1.644227e-04
#>  [2,] -2.405421e-04 -2.732537e-04 -6.512073e-06  3.069526e-04 -4.146015e-05
#>  [3,]  7.057135e-05  1.904161e-04  1.226685e-05 -2.723476e-04  1.433242e-05
#>  [4,]  3.388814e-05 -9.987063e-06 -5.127908e-06  8.681478e-05  1.548560e-07
#>  [5,]  4.716555e-05  6.842619e-05  5.134956e-06  5.490042e-04 -2.220392e-05
#>  [6,]  5.059587e-03  2.557621e-04  1.984039e-06 -2.351024e-04  1.901900e-05
#>  [7,]  2.557621e-04  3.952775e-03 -7.435892e-06 -1.655680e-05  1.317616e-05
#>  [8,]  1.984039e-06 -7.435892e-06  1.732213e-06  5.020645e-06 -2.337059e-07
#>  [9,] -2.351024e-04 -1.655680e-05  5.020645e-06  5.203996e-02 -2.875093e-03
#> [10,]  1.901900e-05  1.317616e-05 -2.337059e-07 -2.875093e-03  5.293205e-04
#> [11,]  6.647344e-05 -2.142037e-06 -1.209126e-06 -6.814099e-03  2.423977e-04
#> [12,]  6.376917e-06  1.805993e-06 -1.173939e-07 -1.936989e-03  2.376435e-05
#> [13,] -3.964387e-05 -1.737692e-05  7.740827e-07  7.368426e-04 -2.778037e-05
#> [14,] -3.930288e-05 -2.535692e-06 -7.952639e-07 -3.836433e-03 -1.431930e-06
#> [15,]  4.087704e-06 -1.765282e-04 -3.391155e-07 -1.984357e-03 -5.333198e-05
#> [16,] -1.146197e-05 -1.935564e-06  2.131599e-07  1.115885e-03 -4.293087e-05
#> [17,]  1.880033e-04  3.219765e-05 -4.836456e-06 -2.266909e-02  8.718631e-04
#>               [,11]         [,12]         [,13]         [,14]         [,15]
#>  [1,]  2.109384e-04  1.107352e-04  1.158975e-04  1.076544e-04  6.753907e-05
#>  [2,] -3.650138e-05 -4.608261e-06  1.552953e-05 -1.654084e-05 -1.053866e-10
#>  [3,] -9.437032e-05  1.043375e-05 -4.412011e-05  6.295897e-05  1.108824e-05
#>  [4,]  3.366305e-06 -6.599734e-06 -9.490494e-06  6.510042e-07  1.315014e-06
#>  [5,] -7.156665e-05 -1.708046e-05 -1.580959e-04 -5.763740e-05 -3.292956e-05
#>  [6,]  6.647344e-05  6.376917e-06 -3.964387e-05 -3.930288e-05  4.087704e-06
#>  [7,] -2.142037e-06  1.805993e-06 -1.737692e-05 -2.535692e-06 -1.765282e-04
#>  [8,] -1.209126e-06 -1.173939e-07  7.740827e-07 -7.952639e-07 -3.391155e-07
#>  [9,] -6.814099e-03 -1.936989e-03  7.368426e-04 -3.836433e-03 -1.984357e-03
#> [10,]  2.423977e-04  2.376435e-05 -2.778037e-05 -1.431930e-06 -5.333198e-05
#> [11,]  3.613824e-03  1.385976e-04 -9.298989e-04  7.587466e-04  5.094344e-04
#> [12,]  1.385976e-04  1.112429e-04  1.951541e-05  1.081176e-04  2.374056e-05
#> [13,] -9.298989e-04  1.951541e-05  3.560490e-03 -5.201957e-04 -1.543931e-04
#> [14,]  7.587466e-04  1.081176e-04 -5.201957e-04  1.547115e-03  3.560933e-04
#> [15,]  5.094344e-04  2.374056e-05 -1.543931e-04  3.560933e-04  2.610028e-03
#> [16,] -2.562175e-04 -2.887601e-05  1.639576e-04 -1.795000e-04 -7.502061e-05
#> [17,]  5.205525e-03  5.865858e-04 -3.331451e-03  3.647134e-03  1.524061e-03
#>               [,16]         [,17]
#>  [1,] -3.080428e-05  6.970318e-04
#>  [2,]  7.411620e-06 -1.629732e-04
#>  [3,] -1.543430e-05  2.957542e-04
#>  [4,] -3.359897e-07  4.406887e-06
#>  [5,]  1.518390e-05 -3.093799e-04
#>  [6,] -1.146197e-05  1.880033e-04
#>  [7,] -1.935564e-06  3.219765e-05
#>  [8,]  2.131599e-07 -4.836456e-06
#>  [9,]  1.115885e-03 -2.266909e-02
#> [10,] -4.293087e-05  8.718631e-04
#> [11,] -2.562175e-04  5.205525e-03
#> [12,] -2.887601e-05  5.865858e-04
#> [13,]  1.639576e-04 -3.331451e-03
#> [14,] -1.795000e-04  3.647134e-03
#> [15,] -7.502061e-05  1.524061e-03
#> [16,]  3.377970e-04 -1.035428e-03
#> [17,] -1.035428e-03  2.163444e-02
#> 
#> $prop_sigmaHC
#>  [1] 0.194029250 0.027420871 0.060937370 0.012029326 0.061873685 0.071130773
#>  [7] 0.062871102 0.001316136 0.228122686 0.023006967 0.060115090 0.010547176
#> [13] 0.059669839 0.039333380 0.051088429 0.018379256 0.147086508
#> 
#> $level
#> [1] "0" "1"
#> 
#> $nObs
#> [1] 3328
#> 
#> $nParam
#> [1] 17
#> 
#> $N0
#> [1] 526
#> 
#> $N1
#> [1] 2802
#> 
#> $NXS
#> [1] 8
#> 
#> $NXO
#> [1] 7
#> 
#> $df
#> [1] 3311
#> 
#> $aic
#> [1] 11706.44
#> 
#> $bic
#> [1] 11810.31
#> 
#> $initial.value
#>  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
#> 
#> attr(,"class")
#> [1] "HeckmanCL" "list"