这么算吧:
predict p1, xb
Above calculate predicted value from regression (equivalent to Ziγ )
replace p1=-p1
Above calculates -Ziγ
generate phi = (1/sqrt(2*_pi))*exp(-(p1^2/2))
This is the normal distribution density function: phi is equivalent to φ(- Ziγ)
generate capphi = normal(p1)
This is the cumulative debsity function: capphi is equivalent to Φ(- Ziγ )
generate invmills1 = phi/(1-capphi)
This calculates Inverse Mills ratio λi(-Ziγ)
俺也需要这个,但是我对这个一点不懂,想请教一下sungmoo 这里面的gw是什么啊?
probit y x1-xn
predict gw, xb
g lambda=normalden(gw,0,1)/normal(gw) if y==1
replace lambda=-normalden(gw,0,1)/normal(-gw) if y==0