全部帖子
规章条例
资料共享
问题求助
信息公告
突发感慨
文章评论
专题评论
|
[资料共享] [转自人大经济论坛]关于求边际影响mfx和margins的命令
评论时间: 2014/12/6 3:07:20 |
最近被回复时间: 2014/12/6 3:07:20 |
浏览次数: 5064 |
跟帖次数: 0
作者: struggle12 | 标签: stata 转自:http://bbs.pinggu.org/thread-2419318-1-1.html 进行回归分析往往要看边际影响, 对于线性模型边际影响就是其系数;
对于不同的模型采用的参数也是不同的,因此,在用margins求边际影响的时候,一定要查看该命令的帮助,看看该命令可以用哪些参数。
每个模型估计的命令都有postestimation ,即估计后可以做的。 如: mlogit 命令就有对应的 postestimation -- Postestimation tools formlogit
几个简单的例子
*例子1:线性回归模型 sysuse auto, clear reg price weight rep78 margins, dydx(*) /*对所有变量求*/ margins, dydx(rep78) /*对rep78求边际影响*/ margins, dydx(rep78) at(weight==2000) /*对rep78求边际影响在weight=1000的时候*/
*例子2: probit 模型 sysuse auto, clear probit foreign price weight rep78 margins, dydx(*) /*对所有变量求*/ margins, dydx(rep78) /*对rep78求边际影响*/ margins, dydx(rep78) at(weight==2000) /*对rep78求边际影响在weight=1000的时候*/
************************************************************************* *例子3: mlogit 模型 sysuse auto, clear tab rep78 /*rep78有5种值*/ mlogit rep78 mpg displ, base(5) /*第五个为参照组,具体模型看计量经济学*/
*mlogit回归结果有多个方程,因此,需要计算不同方程的边际影响 *计算rep78分别等于1,2,3时的边际影响 margins, dydx(*) predict(outcome(1)) margins, dydx(*) predict(outcome(2)) margins, dydx(*) predict(outcome(3))
***************************************************************************** *例子4;ivprobit 模型
webuse laborsup ivprobit fem_work fem_educ kids (other_inc= male_educ)
*计算平均边际影响: 关键是后面的选项 predict(pr) * pr calculates the probability of a positive outcome..
margins, dydx(*) predict(pr)
*****************************************************************************
*例子5;tobit 模型
sysuse auto,clear generate wgt =weight/100 tobit mpg wgt price,ll(17) ul(24) margins, dydx(*) margins, dydx(*)predict(ystar(17,24)) margins, dydx(*)predict( e(17,24))
*****************************************************************************
*例子6;xtlogit 模型*面板数据的其他命令,也是类似,一定要去查manual里面的介绍
选择页码:
每页显示个数:
|
© 版权所有:收入分配研究团队 2012-2024 京ICP备12037474号-1
地址:北京市海淀区新街口外大街19号 邮编:100875
Copyright © 2012-2024 Research Team of Income Distribution. All Rights Reserved
Address: 4th Floor of Jing-shi-xue-tang and Room 9504 of Jingshi Hotel, Beijing Normal University, No. 19 Xinjiekouwai Street, Haidian District, Beijing, 100875.