夏目贵志 发表于 2015-8-4 10:07 http://www.stata.com/bookstore/maximum-likelihood-estimation-stata/
capture program drop restrictedswitchingmodel
program restrictedswitchingmodel
args lnf wage1 wage2 swit sigma1 sigma2
quietly replace `lnf' = ln( normal('swit')* normalden($ML_y1,'wage1','sigma1')+normal(-'swit')* normalden($ML_y2,'wage2','sigma2') )
}
end
constraint 1 lnwage(nonruralspeci)-lnwage2(nonruralspeci)=primary(nonruralspeci)
ml model lf restrictedswitchingmodel (lnwage= eduyear1 experi experi2 nonruralspeci marriage health middle west)(lnwage2= eduyear1 experi experi2 nonruralspeci marriage health middle west) (primary=eduyear1 age nonruralspeci marriage health middle west)(sigma1:)(sigma2:),constraint(1)
ml maximize
问题1:命令到ml model 这行就说(note: constraint number 1 caused error r(133))
问题2:我去掉,constrains(1)时,命令到ml maxizine时 说 invalid name swit swit 是我命名的第三个方程的线性等式。 求教啦!!!!