Title 
Computation of rho, disturbance correlation, in the twostep Heckman estimator.
Technical FAQ 

Author  Vince Wiggins, StataCorp 
Technical FAQ: This is a technical FAQ. Technical FAQs address specific issues or computational aspects of estimators or other commands. They are typically written for someone who already knows and fully understands the statistics of the command—an expert in the area. All the materials in the Stata manual, including the Methods and Formulas and sometimes the references, are assumed to be understood.
These FAQs often deal with issues that are not considered or adequately addressed in the literature, and, as such, we welcome insights from readers or related citations that we may have missed.
Stata’s maximum likelihood estimator for a regression model with selection constrains the estimated correlation among the regression and selection equation to be in the admissible range of a correlation, [−1,1]. This estimation is performed by heckman, and the command allows estimation of the same model using Heckman’s (1979) twostep estimator with associated variance–covariance matrix (VCE). One issue with the twostep estimator is that it can produce estimates of rho that lie outside the range [−1,1] and this can, in rare cases, lead to an estimated VCE that is not positive definite and may even have negative elements on the diagonal.
Greene (1981) notes this possibility but offers no solution. Stata provides four ways of handling twostep estimates of rho outside the admissible range. These are options that work with heckman ..., twostep. From the heckman help file:
rhosigma, rhotrunc, rholimited and rhoforce are rarely used options to specify how the twostep estimator (option twostep) handles unusual cases in which the twostep estimate of rho is outside the admissible range for a correlation, [−1,1]. When rho is outside this range, the twostep estimate of the coefficient variance–covariance matrix may not be nonpositivedefinite and thus may be unusable for testing. The default is rhosigma.
rhotrunc specifies that rho be truncated to lie in the range [−1,1]. If the twostep estimate is less than −1, rho is set to −1; if the twostep estimate is above 1, rho is set to 1. This truncated value of rho is used in all computations to estimate the twostep covariance matrix.
rhosigma specifies that rho be truncated, as with option rhotrunc, and that the estimate of sigma be made consistent with rho_hat, the truncated estimate of rho. So, sigma_hat = B_m * rho_hat; see the Methods and Formulas section of [R] heckman for the definition of B_m. Both the truncated rho and the new estimate of sigma_hat are used in all computations to estimate the twostep covariance matrix.
rholimited specifies that rho be truncated only in the computation of diagonal matrix D as it enters V_twostep and Q; see [R] heckman Methods and Formulas. In all other computations the untruncated estimate of rho is used.
rhoforce specifies that the twostep estimate of rho be retained even if it is outside the admissible range for a correlation. This may, in rare cases, lead to a nonpositivedefinite covariance matrix.
These options have no effect when estimation is by maximum likelihood, the default. They also have no effect when the twostep estimate of rho is in the range [−1,1].
Other than method rhoforce, these are ad hoc methods of imposing the constraint that a correlation must be between −1 and 1. Asymptotically, this will always be true, but the standard twostep estimator does not impose the constraint. With method rhoforce one accepts the twostep estimate of rho and simply hopes not to get a nonpositivedefinite VCE. In the rare case when the VCE is not positive definite, the VCE is set to 0 and tests are disallowed.
Method rhosigma was chosen as the default for heckman, twostep based on the coverage probabilities for the null hypothesis from simulations with disturbance variances and sample sizes likely to generate estimates of rho outside the admissible range. The dofile that performs these simulations can be obtained by clicking here. The parameters controlling number of observations, expected censoring rate, rho, and number of simulation repetitions are set by global macros at the top of the file. The model for the simulations has three covariates in the regression equation, and two covariates in the selection equation. Some of these covariates are correlated both within and across equations; see the dofile for how the data are simulated.
Seven simulations were performed:
Simulation  N  Rho  Selection probability 
Simulation
repetitions 

1  50  0.80  .4  1000 
2  100  −.85  .4  1000 
3  100  0.40  .8  1000 
4  200  0.60  .6  1000 
5  300  0.60  .6  1000 
6  1000  0.60  .4  1000 
7  1000  0.40  .8  1000 