This is a way to calculate a logistic Inverse Mills ratio.

The logistic IMR has some benefits when estimating a model (including correction for selection) on panel data. Because of the incidental parameter problem, it is not possible to estimate Probit FE. Hence, many researchers use a Probit RE model for the selection equation and then estimate the main FE model including the retrieved IMR. A problem which this approach is that the assumptions made are usually not plausible (differences in the correlation between regressors and the unobserved heterogeneity terms in the selection equation and the equation of interest).

A simple solution is estimating a logit FE model (which does not suffer from the incidental parameter problem) and then deriving the logistic IMR as follows:

`capture drop xblogit pcdf lambda`

xlogit ...

predict xblogit, xb

gen pcdf = 1/(1+exp(-xblogit))

gen lambda = normalden(invnorm(pcdf))/pcdf

Nice! Welcome to the STATA blog, Raymond.

Thank you very much for this post. I wanted to know if this can be done witha weibull regression (a parametric survival model). As a matter of fact what I would like to do is make an initial weibull regression, estimate the lambda (the inverse mills ratio) and introduce it as a correction varibale in a second weibull regression (over the part of the sample that was >0 in the first regression. Do you think I can do this? If so, i was thinking of calculating pcdf according to the weibull cummulative distribution, that is:

gen pcdf = 1-exp(Yweibull)

What do you think of this?

Thanks ,

Alicia