Two-step M-estimator
Two-step M-estimators deals with M-estimation problems that require preliminary estimation to obtain the parameter of interest. Two-step M-estimation is different from usual M-estimation problem because asymptotic distribution of the second-step estimator generally depends on the first-step estimator.  Accounting for this change in asymptotic distribution is important for valid inference.

Description
The class of two-step M-estimators includes Heckman's sample selection estimator, weighted non-linear least squares, and ordinary least squares with generated regressors.

To fix ideas, let   be an i.i.d. sample.  and  are subsets of Euclidean spaces  and , respectively. Given a function  , two-step M-estimator    is defined as:

where  is an M-estimate of a nuisance parameter that needs to be calculated in the first step.

Consistency of two-step M-estimators can be verified by checking consistency conditions for usual M-estimators, although some modification might be necessary. In practice, the important condition to check is the identification condition. If   where  is a non-random vector, then the identification condition is that   has a unique maximizer over .

Asymptotic distribution
Under regularity conditions, two-step M-estimators have asymptotic normality. An important point to note is that the asymptotic variance of a two-step M-estimator is generally not the same as that of the usual M-estimator in which the first step estimation is not necessary. This fact is intuitive because   is a random object and its variability should influence the estimation of . However, there exists a special case in which the asymptotic variance of two-step M-estimator takes the form as if there were no first-step estimation procedure. Such special case occurs if:

where  is the true value of  and   is the probability limit of . To interpret this condition, first note that under regularity conditions,   since  is the maximizer of  .  So the condition above implies that small perturbation in γ has no impact on the first-order condition. Thus, in large sample, variability of    does not affect the argmax of the objective function, which explains invariant property of asymptotic variance. Of course, this result is valid only as the sample size tends to infinity, so the finite-sample property could be quite different.

Involving MLE 
When the first step is a maximum likelihood estimator, under some assumptions, two-step M-estimator is more asymptotically efficient (i.e. has smaller asymptotic variance) than M-estimator with known first-step parameter. Consistency and asymptotic normality of the estimator follows from the general result on two-step M-estimators.

Let {Vi,Wi,Zi} be a random sample and the second-step M-estimator  is the following:

where   is the parameter estimated by maximum likelihood in the first step.  For the MLE,

where f is the conditional density of V given Z.  Now, suppose that given Z, V is conditionally independent of W. This is called the conditional independence assumption or selection on observables. Intuitively, this condition means that Z is a good predictor of V so that once conditioned on Z, V has no systematic dependence on W. Under the conditional independence assumption, the asymptotic variance of the two-step estimator is:

where

and  represents partial derivative with respect to a row vector. In the case where  is known, the asymptotic variance is

and therefore, unless , the two-step M-estimator is more efficient than the usual M-estimator.  This fact suggests that even when  is known a priori, there is an efficiency gain by estimating  by MLE. An application of this result can be found, for example, in treatment effect estimation.

Examples 
 Generated regressor
 Heckman correction
 Feasible generalized least squares
 Two-step feasible generalized method of moments

See also 
 Adaptive estimator

References 

M-estimators
Estimator
Robust regression
Robust statistics