一般stata13 14都没问题,但stata15 16就不行了。我在STATALIST论坛里看到了一个解决方法,是JanDitzen提出的,他给了一个叫xtpmg2的ado file,我安装完这个就没问题了。
我分享下那个ado file的链接吧:
链接:
https://pan.baidu.com/s/1-eIlblz4JfOPJGVZUpawAA 密码:xbjp
他的原文是这么说的:
I can confirm the problem in Stata 16 (16.0, latest update). Using Stata 15.0 it still works, but with 15.1 it does not work. In Stata 14.2 it is working. Thus there must have been a change from 15.0 to 15.1.
Using trace, xtpmg stops working when predicting fitted values. The command line is:
Code:
_predict double ec if __000003, eq(ec)
xtpmg does not come with it's own predict command, it uses Stata's _predict command. There was an update to predict on 20 February 2019, see help whatsnew15. The change reads:
14. predict, when specified with a new variable name that matches a variable in the current estimation results, now exits with an error message even when that variable does not exist in the current dataset. The old behavior, which provided invalid predicted values, is not preserved under version control.
Is my reading that correct, that predicted values were invalid?
I had a further look at the code of xtpmg and it looks like the predicted values are not required. When removing the lines, xtpmg works and I obtain the same results. I attached the ado file and called the program xtpmg2. Please check.
Jan