# 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 $\{W_{i}\}_{i=1}^{n}\subseteq R^{d}$ be an i.i.d. sample. $\Theta$ and $\Gamma$ are subsets of Euclidean spaces $R^{p}$ and $R^{q}$, respectively. Given a function $m(;;;):R^{d}\times \Theta \times \Gamma \rightarrow R$ , two-step M-estimator ${\hat {\theta }}$ is defined as:
    ${\hat {\theta }}:=\arg \max _{\theta \in \Theta }{\frac {1}{n}}\sum _{i}m{\biglW_{i},\theta ,{\hat {\gamma }}{\bigr )}$
where ${\hat {\gamma }}$ 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 ${\hat {\gamma }}\rightarrow \gamma ^{*},$ where $\gamma ^{*}$ is a non-random vector, then the identification condition is that $E[m(W_{1},\theta ,\gamma ^{*})]$ has a unique maximizer over $\Theta$.

### 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 ${\hat {\gamma }}$ is a random object and its variability should influence the estimation of $\Theta$. 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:
    $E{\frac {\partial }{\partial \theta \partial \gamma }}m(W_{1},\theta _{0},\gamma ^{*})=0$
where $\theta _{0}$ is the true value of $\theta$ and $\gamma ^{*}$ is the probability limit of ${\hat {\gamma }}$. To interpret this condition, first note that under regularity conditions, $E{\frac {\partial }{\partial \theta }}m(W_{1},\theta _{0},\gamma ^{*})=0$ since $\theta _{0}$ is the maximizer of $E[m(W_{1},\theta ,\gamma ^{*})]$. So the condition above implies that small perturbation in γ has no impact on the first-order condition. Thus, in large sample, variability of ${\hat {\gamma }}$ 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 {V$_i$,W$_i$,Z$_i$}$^n$ $_{i=1}$ be a random sample and the second-step M-estimator ${\widehat {\theta }}$ is the following:
    ${\widehat {\theta }}:={\underset {\theta \in \Theta }{\operatorname {arg\max } }}\sum _{i=1}^{n}m(v_{i},w_{i},z_{i}:\theta ,{\widehat {\gamma }})$
where ${\widehat {\gamma }}$ is the parameter estimated by maximum likelihood in the first step. For the MLE,
    ${\widehat {\gamma }}:={\underset {\gamma \in \Gamma }{\operatorname {arg\max } }}\sum _{i=1}^{n}\log f(v_{it}:z_{i},\gamma )$
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:
    $\mathrm {E} [\nabla _{\theta }s(\theta _{0},\gamma _{0})]^{-1}\mathrm {E} [g(\theta _{0},\gamma _{0})g(\theta _{0},\gamma _{0})^{\mathrm {T} }]\mathrm {E} [\nabla _{\theta }s(\theta _{0},\gamma _{0})]^{-1}$
where
    ${\begin{aligned}g(\theta ,\gamma )&:=s(\theta ,\gamma )-\mathrm {E} [\nabla _{\gamma }s(\theta ,\gamma )]\mathrm {E} [d(\gamma )d(\gamma )^{\mathrm {T} }]^{-1}d(\gamma )\\s(\theta ,\gamma )&:=\nabla _{\theta }m(V,W,Z:\theta ,\gamma )\\d(\gamma )&:=\nabla _{\gamma }\log f(V:Z,\gamma )\end{aligned}}$
and ∇ represents partial derivative with respect to a row vector. In the case where γ$_0$ is known, the asymptotic variance is
    $\mathrm {E} [\nabla _{\theta }s(\theta _{0},\gamma _{0})]^{-1}\mathrm {E} [s(\theta _{0},\gamma _{0})s(\theta _{0},\gamma _{0})^{\mathrm {T} }]\mathrm {E} [\nabla _{\theta }s(\theta _{0},\gamma _{0})]^{-1}$
and therefore, unless $\mathrm {E} [\nabla _{\gamma }s(\theta ,\gamma )]=0$, the two-step M-estimator is more efficient than the usual M-estimator. This fact suggests that even when γ$_0$ 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