Quantcast
Viewing all articles
Browse latest Browse all 1129

Re: Probit model with sample selection by mlexp

Don't know if anyone is going to see this but I am trying to replicate your code and get the following error when trying to implement the first mlexp command:

variable _cons not found
r(111);

I am using Stata/SE 13.1

Here's my code:

drop _all
set seed 441
set obs 7000
generate x = .5*rchi2(2)
generate z = rnormal()
generate b = rbinomial(2,.5)
matrix cm = (1,.7 \ .7,1)
drawnorm ey es, corr(cm)
generate s = z + 1.3*0.b + 1.b + .5*2.b + es > 0
generate y = .7*x + ey + .5 > 0
replace y = . if !s
mlexp (ln(cond(y,normal({y: x _cons}),1-normal({y:})))), variables(y)
mlexp (ln(cond(s,cond(y,binormal({y: x _cons},{s: z ibn.b}, {rho}), binormal(-{y:},{s:}, -{rho})),1-normal({s:}))))

Any thoughts?


Viewing all articles
Browse latest Browse all 1129

Trending Articles