Heckman two-stage is used to solve the selection bias problem in the estimation model.
*MLE, the dependent variable in the selection model is the dummy variable of y.
heckman y x1 x2 x3, select(z1 z2 z3) vce(cluster clustervar robust)
*MLE, twostep, the dependent variable in the selection model is the dummy variable of y.
heckman y x1 x2 x3, select(z1 z2 z3) twostep
*MLE, twostep, the dependent variable in the selection model is w, a dummy variable equals 1 if the observation is selected, and 0 otherwise.
heckman y x1 x2 x3, select(x1 = z1 z2 z3) twostep
heckman y x1 x2 x3, select(x1 = z1 z2 z3) twostep first nolog
// report the first stage,nolog means do not report the iretation process of the probit model
The selection part must contain a variable that is different from the variables in the outcome equations.
If you use the twostage option, the vce(cluster clustervar robust), weights and score() options are not allowed.