Estimating Equations for Treatment Model in Treatment Effects Estimation — How is this Equation Derived? While reading the STATA 14 Treatment Effects Reference Manual (http://www.stata.com/manuals14/te.pdf), I'm having difficulty understanding how they arrive at the equation for the treatment model, that is (p. 230 bottom):

In the $\mathsf{logit}$ and $\mathsf{probit}$ cases,
$$\mathbf{s}_{\text{tm},i}(\mathbf{z}_i,\widehat{\gamma})
= \left[
\frac{g(\mathbf{z}_i\widehat{\gamma}') \{t_i-G(\mathbf{z}_i\widehat{\gamma}')\}}
{G(\mathbf{z}_i\widehat{\gamma}') \{1-G(\mathbf{z}_i\widehat{\gamma}')\}}
\right]
\mathbf{z}_i$$
where $G(z)$ is the logistic cumulative distribution function for the logit, $G(z)$ is the normal cumulative distribution function for the probit, and $g(\cdot)=\{ \partial G(z)\}/(\partial z)$ is the corresponding density function.

I understand estimating equations as a form of GMM or M-estimator, but this looks different since there is a strange denominator that looks like the variance of a logistic function $$G(\mathbf{z}_i\widehat{\gamma}') \{1-G(\mathbf{z}_i\widehat{\gamma}')\}.$$ I can't find it in the references. Can anyone explain exactly where each of the components come from? And possibly show how this corresponds to standard GMM/estimating equations theory?
 A: To see this, first consider GMM or M-estimator theory combined with that of generalised linear modelling (GLM). Based on weighted least squares and $\mathbf{X}$ and $Y$ the independent variables and dependent variable respectively, a GLM estimator of $\beta$ has estimating equations 
\begin{equation}\mathbf{D'V}^{-1}(Y-h^{-1}(\mathbf{X}\beta)) = 0,\label{first}\tag{1}\end{equation}
where $h^{-1}$ is the inverse of the link function (or the mean function, the expectation of $Y$), $\mathbf{V}$ is a known or otherwise computed or modelled covariance/weighting matrix of $Y$ and $\mathbf{D}$ is the first derivative of $h^{-1}$ w.r.t. $\beta$ (see any advanced statistics textbook on GMMs).
Now for bringing this toward the equation in question, we can see that $h^{-1}(\cdot)=G(\cdot)$, which is e.g. the logistic function, offered as a possibility in the cited text. The corresponding logit function $h$ is the cannonical link in case $E[Y]$ follows a Bernoulli or binomial distribution. Furthermore, $Y_i=t_i$ and $X_i\beta = \mathbf{z}_i\widehat{\gamma}'$ (for observation $i$). Hence, $\mathbf{D}$ is formed by (abusing some notation)
$$\frac{\partial G(\mathbf{z}_i\widehat{\gamma}')}{\partial\widehat{\gamma}'}=\frac{\partial G(z)}{\partial z }\frac{ \partial z}{\partial \widehat{\gamma}'} = g(\mathbf{z}_i\widehat{\gamma}')\mathbf{z}_i.$$
Further, as mentioned, $G(\mathbf{z}_i\widehat{\gamma}') \{1-G(\mathbf{z}_i\widehat{\gamma}')\}$ is equal to the variance of the binomial distribution, which $Y$ follows, so equal to $V_i$.
Finally, $$Y_i-h^{-1}(\mathbf{X_i}\beta) = t_i-G(\mathbf{z}_i\widehat{\gamma}').$$
Notice that $\mathbf{s}_{\text{tm},i}(\mathbf{z}_i,\widehat{\gamma})$ is a $k\times 1$ vector, with $k$ the number of independent variables or parameters in $\beta$, so the system is exactly identified and can be estimated. The cited paragraph only considers one observation, subscripted with $i$, while $\eqref{first}$ considers them altogether, summed in a matrix multiplication, but otherwise also  $k\times 1$.
It is true that the Stata documentation is somewhat unclear, not stating at least where the factors originate from or providing an exact reference.
