Let $\mu$ and $\sigma$ be two parameters of interest characterising a normal distribution. From a theoretical model, I know that these two parameters are related to each-other according to

$$\pi=\Phi\left(\frac{\Phi^{-1} (\alpha)-\mu}{\sigma}\right)$$

where $\Phi(\cdot)$ is the CDF of the standard normal and $\pi$ and $\alpha$ are random variables, for which I observe a number of realisations (let me note the empirical realisations $\hat{\pi}_i$ and $\hat{\alpha}_i$ for $i=1,2,..n$).

Based on this, I would like to estimate $\mu$ and $\sigma$ using minimum distance, namely $$ \arg\min\limits_{\mu,\sigma}\sum^n_{i=1}\left( \hat{\pi}_i- \Phi\left(\frac{\Phi^{-1} (\hat{\alpha}_i)-\mu}{\sigma}\right)\right)^2 w_i $$ for some vector of weights $\{w_1,w_2,..w_n\}$.

How do I implement that in STATA? If my understanding of the methods is correct, I believe I should be able to do this using the General Method of Moments. I tried using gmm in Stata, but it gave me an error message. Specifically, I tried

gmm (pi - normal((invnormal(alpha)-{mu})/{sigma})), instruments(pi alpha)

but received an error message saying no non-missing values returned for equation 1 at initial values


2 Answers 2


You need to change the initial value of sigma. Default is zero, so you're dividing by zero and get missings at your initial values, as your error message indicates.


The gmm code provided in the OP is correct, but it requires an initial condition for $\sigma$. Here is a working example.

set obs 10000
gen alpha       = rnormal()
gen alpha_cum   = normal(alpha)
scalar mu       = 2
scalar sigma    = 3
gen pi_real     = normal((invnormal(alpha_cum)-mu)/sigma)
gen error       = rnormal(0,1) 
gen pi_observed = pi_real + error
gen z           = rnormal()

Running gmm (pi_observed - normal((invnormal(alpha_cum)-{mu})/{sigma})), instruments(alpha_cum pi_observed) gives the error message: no non-missing values returned for equation 1 at initial values

Running gmm (pi_observed - normal((invnormal(alpha_cum)-{mu})/{sigma=1})), instruments(alpha_cum pi_observed)


             |               Robust
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
         /mu |   1.737236   .1612666    10.77   0.000      1.42116    2.053313
      /sigma |   2.702077   .2730999     9.89   0.000     2.166811    3.237343

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.