发布网友 发布时间:2022-05-27 15:35
共1个回答
热心网友 时间:2023-10-31 06:34
解决logit 不收敛通过以下。
1. logit 对应逻辑分布,probit对应标准正态分布的假设,在估计的时候使用的都是MLE最大似然估计。
2. 最大似然估计有一个特点,就是在不断迭代iteration中,寻找到最大化似然函数的那个估计值
3. 因此,问题常常处在iteration的过程中,一般有两种:第一是出现(not concave),第二是出现(back up)。需要注意的是,只要这两个不出现在最后一行iteration的后面,就都不是事儿,不用管。但是如果出现在最后一行,或者一直在iteration不汇报结果,那么就有问题了。比如下面这样:
Iteration 4441: log pseudolikelihood = -51554.273 (backed up)
Iteration 4442: log pseudolikelihood = -51554.273 (backed up)
Iteration 4443: log pseudolikelihood = -51554.273 (backed up)
4. 根据stata的官方文件,not concave的问题在于:可能是存在自变量的共线性问题;或者数据结构中,最优的点的位置不是concave的,是一个“平台”。
If a “not concave” message appears at the last step, there are two possibilities. One is that the result is valid, but there is collinearity in the model that the command did not otherwise catch. Stata checks for obvious collinearity among the independent variables before performing the maximization, but strange collinearities or near collinearities can sometimes arise between coefficients and ancillary parameters. The second, more likely cause for a “not concave” message at the final step is that the optimizer entered a flat region of the likelihood and prematurely declared convergence
5. 根据stata的官方文件,back up的问题在于:可能是找到了一个完美的point,已经找不到更好的继续iteration的点的(大概率不可能);另外有可能是根据优化路径,路径太坏,不知道下一步向哪里优化。【论坛上面有人认为原因是:数据质量差,或者存在共线性问题,或者存在异常值的问题干扰估计】
If a “backed up” message appears at the last step, there are also two possibilities. One is that Stata found a perfect maximum and could not step to a better point; if this is the case, all is fine, but this is a highly unlikely occurrence. The second is that the optimizer worked itself into a bad concave spot where the computed gradient and Hessian gave a bad direction for stepping.
6. 解决方法:使用gradient 或者difficult 的option;或者我觉得也可以更换technique的option,就是更换做迭代iteration的方法,常用的有nr,bhhh,dfp,bfgs,其中nr是默认选项。
【difficult】 specifies that the likelihood function is likely to be difficult to maximize because of nonconcave regions. When the message “not concave” appears repeatedly, ml’s standard stepping algorithm may not be working well. difficult specifies that a different stepping algorithm be used in nonconcave regions. There is no guarantee that difficult will work better than the default; sometimes it is better and sometimes it is worse. You should use the difficult option only when the default stepper declares convergence and the last iteration is “not concave” or when the default stepper is repeatedly issuing “not concave” messages and procing only tiny improvements in the log likelihood.
【gradient】 adds to the iteration log a display of the current gradient vector.
【technique(algorithm spec)】 specifies how the likelihood function is to be maximized. The following algorithms are allowed. For details, see Gould, Pitblado, and Poi (2010). technique(nr) specifies Stata’s modified Newton–Raphson (NR) algorithm. technique(bhhh) specifies the Berndt–Hall–Hall–Hausman (BHHH) algorithm. technique(dfp) specifies the Davidon–Fletcher–Powell (DFP) algorithm. technique(bfgs) specifies the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm.
加入gradient之后,如果gradient变成0的时候,最终的结果就是可以接受的优化结果,但如果不是0,那么得到的就不是valid的结果,需要对于收敛进行严格定义,比如使用 ltol(0) tol(1e-7) 等。
If the gradient goes to zero, the optimizer has found a maximum that may not be unique but is a maximum. From the standpoint of maximum likelihood estimation, this is a valid result. If the gradient is not zero, it is not a valid result, and you should try tightening up the convergence criterion, or try ltol(0) tol(1e-7) to see if the optimizer can work its way out of the bad region.
使用difficult的option的时候,也要注意,可能会得到更坏的结果。
If you get repeated “not concave” steps with little progress being made at each step, try specifying the difficult option. Sometimes difficult works wonderfully, recing the number of iterations and procing convergence at a good (that is, concave) point. Other times, difficult works poorly, taking much longer to converge than the default stepper.
7. 最后提醒大家,logit和probit是可以通过iterate(#) 这个option来*最大迭代次数的,但是一般都不建议使用,因为这样很有可能得到的是无效的结果。