I illustrate this point with an artificial dataset.
clear all
set seed 2038942
set obs 10000
gen i=_n
gen u=rnormal(0,0.5)
mat m=(0, 1, 2)
mat sd=(1, 2, 3)
drawnorm x1 x2 x3, means(m) sds(sd)
gen y=2*x1+4*x2-0.5*x3+u
replace y=cond(y>0, y, 0)
set seed 2038942
set obs 10000
gen i=_n
gen u=rnormal(0,0.5)
mat m=(0, 1, 2)
mat sd=(1, 2, 3)
drawnorm x1 x2 x3, means(m) sds(sd)
gen y=2*x1+4*x2-0.5*x3+u
replace y=cond(y>0, y, 0)
Then I ran the Tobit model on my data
tobit y x1 x2 x3, ll(0)
margins, dydx(_all) predict(ystar(0,.))
My understanding of the reason for this message is that the calculation of APE involves the inverse mill ratio (IMR). The denominator of the IMR is the cdf of the standard normal distribution ϕ(xb). If the linear predictions xb for some observations are very negative, then Stata treats the ϕ(xb) as zero, despite that the 'true' ϕ(xb) is not. Thus, I get some 'missing predicted values'.
To verify this thought, I made the following prediction for each observation.
predict y_hat, ystar(0,.)
tobit y x1 x2 x3, ll(0)
scalar sd=sqrt(e(b)[1,5])
predict y_fit, xb
gen Phi=normal(y_fit/sd)
scalar sd=sqrt(e(b)[1,5])
predict y_fit, xb
gen Phi=normal(y_fit/sd)
Does anyone know if my understanding of the presence of missing values is correct? If so, is there any suggestions on how to write the margin command to avoid this error message (i.e. Stata can ignore the missing values)? Thank you for your suggestions.
0 Response to Margins and Predict for Tobit estimation
Post a Comment