楼主: amyzff
11478 14

[其他] stata中极大似然估计 [推广有奖]

11
sungmoo 发表于 2012-3-8 18:07:28
*不知道你的i具体取何值,只以一种情况为例(在do-file中do以下):

clear
inp
t p
0 .99999
.1 .99999
.5 .99999
1 .99999
2 .99999
5 .99999
10 .99999
15 .5
20 .5
50 1.0e-05
end

*以上只是输入数据,以下是估计

prog drop _all                                                                                                                 
prog mynormal                                                                                                                     
args lnf mu sigma                                                                                                        
qui replace `lnf' = lnnormalden($ML_y1-1+ normal(($ML_y2-`mu')/`sigma') )
end

ml mod lf mynormal (mu:p t=)(sigma:p t=)
ml max

*由于样本量只有10,所以很可能估计不出结果。

12
sungmoo 发表于 2012-3-8 18:09:19
tij        pij        pij        pij        pij        pij        pij
这肯定还不是dta文件中原来的变量形式(dta文件中不可能有重名变量)。如果不把变量原原本本写出来,无法具体写出循环式,只能举一种情况为例。

13
amyzff 发表于 2012-3-13 10:54:10
sungmoo 发表于 2012-3-8 18:07
*不知道你的i具体取何值,只以一种情况为例(在do-file中do以下):

clear
非常感谢,我用你的写的程序做了一下
出现如下结果
initial:       log likelihood =     -<inf>  (could not be evaluated)
feasible:      log likelihood = -9.9588383
rescale:       log likelihood = -9.9519595
rescale eq:    log likelihood = -9.9393753
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 0:   log likelihood = -9.9393753  
numerical derivatives are approximate
flat or discontinuous region encountered
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 1:   log likelihood = -9.9393753  
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 2:   log likelihood = -9.9393753  
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 3:   log likelihood = -9.9393753  
numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 4:   log likelihood = -9.9393753  
Iteration 5:   log likelihood = -9.9393753  (not concave)

14
amyzff 发表于 2012-3-17 23:04:44
求助

15
amyzff 发表于 2012-3-18 13:52:19
help

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-9 18:11