全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
3941 4
2021-02-04
我研究的是沪深A股公司2017年-2019年被ST与否对散户持股比例的影响
第一步双重差分用的是固定效应模型,输入命令如下
reg rethold ST  i.year i.stkcd,r  (rethold为散户持股比例,ST是个体、时间虚拟变量交乘项)
输入指令后显示
maxvar too small
    You have attempted to use an interaction with too many levels or attempted to fit a model with too many variables.
    You need to increase maxvar; it is currently 5000.  Use set maxvar; see help maxvar.

    If you are using factor variables and included an interaction that has lots of missing cells, either increase maxvar
    or set emptycells drop to reduce the required matrix size; see help set emptycells.

    If you are using factor variables, you might have accidentally treated a continuous variable as a categorical,
    resulting in lots of categories.  Use the c. operator on such variables.

然后换命令为xtreg rethold ST  i.year,fr 可以跑出了
但是后边需要做一个三重差分,把价格高低作为虚拟变量再加进去,所以还要继续使用以下命令
reg rethold ST ST#P  i.year##i.stkcd,r  (P为价格高低虚拟变量)
所以后边还是要用reg的命令,我的数据比较多大概二百多万条,之前看到用set max 但是最多也达不到两百万,所以请问有什么方法吗,或者可以用其他什么回归方法吗?
(没有计量和stata基础,所以很多东西不知道,如果需要学习什么新命令,劳烦留下代码我自己去查,万分感谢!)

数据如下
复制代码





二维码

扫码加我 拉你入群

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

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

全部回复
2021-2-4 18:36:28
应该是由于 i.stkcd 产生上千个虚拟变量所造成的,请安装 reghdfe (http://scorreia.com/software/reghdfe/install.html),并试试
复制代码
二维码

扫码加我 拉你入群

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

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

2021-2-4 19:13:21
黃河泉 发表于 2021-2-4 18:36
应该是由于 i.stkcd 产生上千个虚拟变量所造成的,请安装 reghdfe (http://scorreia.com/software/reghdfe/ ...
已经跑出来了!感谢黄老师的回复!!
二维码

扫码加我 拉你入群

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

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

2021-2-5 01:11:40
我想补充一下,你这模型设定有问题,reg rethold ST ST#P  i.year##i.stkcd,r ,这里控制了个体和时间固定效应,而且还控制i.year#i.stkcd,这是不可能跑出结果出来的。所以如果你跑的是这个代码,那肯定会报错的。
二维码

扫码加我 拉你入群

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

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

2021-2-5 11:33:18
zdlspace 发表于 2021-2-5 01:11
我想补充一下,你这模型设定有问题,reg rethold ST ST#P  i.year##i.stkcd,r ,这里控制了个体和时间固定效 ...
这个确实也没跑出来,我是之前看了中国工业经济里有个做多期did的这样写的我借鉴了一下,但是确实是跑不出来,还不知道该怎么办,因为后边做的是个三重差分,还需要在原来的基础上再控制一次(其实我也不太理解那篇文章里这样输入命令的原因到底是为了控制什么,就是因为自己实在没招了)
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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