全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1053 1
2012-11-15
悬赏 10 个论坛币 未解决
求教下面的那个变量如何在stata中实现:
|iki,t-ik-i,t-1| is the absolute value of the difference between ik (the investment ratio) of firm i in year t and the average (第二个ik 上面应该有个横杠,不知道怎么弄出来) investment ratio of other firms in the same industry excluding firm i in year (t-1)

PS:数据为panel data,包括firmid,year,ik等数据




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-11-15 04:26:34
bys year: egen x1=total(ik)   //ki在每年的总和
bys year: gen n=_N     //公司个数
bys year: gen mean=(x1-ik)/(n-1)   //你要的均数

gen diff=abs(ik[_n]-mean[_n-1])
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群