plm-具有公司年数据的行业+年固定收益

时间:2020-04-27 08:48:41

标签: r panel-data plm economics

我的问题是,当同一年在同一行业中有多家公司时,如何在plm中包括行业和年度固定影响? 我的数据转发如下:

Year    Industry    CompanyID   CEOID   CEO.background  MBA.CEO CEO.Tenure  Female.CEO  CEO.age Capex       Log.TA      Leverage
2005    6           1075        10739   0               0       6.92        0           55      0.08623238  9.199961396 0.330732917
2006    6           1075        10739   0               0       7.92        0           56      0.097455145 9.334559982 0.26575725
2007    6           1075        10739   0               0       8.92        0           56      0.113033772 9.346263914 0.285439531
2008    6           1075        10739   0               0       9.92        0           57      0.108640177 9.327564318 0.322985772
2009    6           1075        5835    0               0       0.67        0           54      0.08526524  9.360491034 0.333880116
2010    6           1075        5835    0               0       1.67        0           55      0.081452292 9.376545673 0.32197511
2005    6           1743        8379    0               0       17.43       0           65      0.236487293 6.693007633 0.021915227
2006    6           1743        26012   0               1       0.91        0           59      0.319264835 6.820455133 0.023157959
2007    6           1743        26012   0               1       1.91        0           58      0.207384938 6.844512984 0.020087012
2008    6           1743        26012   0               1       2.92        0           59      0.130632264 6.890964093 0.017103795
2009    6           1743        26012   0               1       3.92        0           60      0.112029325 6.879662342 0.017283796
2010    6           1743        30801   0               0       1           1           47      0.02804693  6.767971236 0.044755539
2005    7           1004        9249    0               0       9.65        0           53      0.076370794 6.596094672 0.31534354
2006    7           1004        9249    0               0       10.65       0           54      0.114891589 6.886346743 0.327808308
2007    7           1004        9249    0               0       11.65       0           55      0.097727719 6.973199328 0.307086799
2008    7           1004        9249    0               0       12.65       0           56      0.112119583 7.216716829 0.389800369
2009    7           1004        9249    0               0       13.65       0           57      0.086281135 7.228033526 0.331455792
2010    7           1004        9249    0               0       14.65       0           58      0.298922358 7.313914813 0.291147083

CEO.backgroundMBA.CEOFemale.CEO是每个CEO的时变虚拟变量,以及公司的行业时变虚拟变量,而其余是时变的公司/ CEO属性。

>

我想对行业/年回归代码运行以下固定效果:

plm(Capex ~ CEO.background + MBA.CEO + CEO.Tenure + Female.CEO + CEO.age + Log.TA + Leverage, data=repexcapex, index = (c("Industry", "Year")), model = "within", effect = "twoways")

但是,如果我在同一行业中有多家公司,例如上述数据(行业6中的公司ID均为1075/1743),则代码会给出有关重复项的错误。

Error in pdim.default(index[[1]], index[[2]]) : 
  duplicate couples (id-time)
In addition: Warning messages:
1: In pdata.frame(data, index) :
  duplicate couples (id-time) in resulting pdata.frame
[...]

如果我杀死前5行并在每个行业仅由1家公司经营它,则代码有效。

我应该如何制定回归模型以包含行业和年度固定影响?正在使用下面的行业虚拟变量运行代码,等同于行业固定效果:

plm(Capex ~ CEO.background + MBA.CEO + CEO.Tenure + Female.CEO + CEO.age + Log.TA + Leverage + factor(Industries), data=repexcapex, index = (c("Year")), model = "within", effect = "individual")

这是格式化的数据:

repexcapex <- read.table(text="
Year,Industry,CompanyID,CEOID,CEO.background,MBA.CEO,CEO.Tenure,Female.CEO,CEO.age,Capex,Log.TA,Leverage
2005,6,1075,10739,0,0,6.92,0,55,0.08623238,9.199961396,0.330732917
2006,6,1075,10739,0,0,7.92,0,56,0.097455145,9.334559982,0.26575725
2007,6,1075,10739,0,0,8.92,0,56,0.113033772,9.346263914,0.285439531
2008,6,1075,10739,0,0,9.92,0,57,0.108640177,9.327564318,0.322985772
2009,6,1075,5835,0,0,0.67,0,54,0.08526524,9.360491034,0.333880116
2010,6,1075,5835,0,0,1.67,0,55,0.081452292,9.376545673,0.32197511
2005,6,1743,8379,0,0,17.43,0,65,0.236487293,6.693007633,0.021915227
2006,6,1743,26012,0,1,0.91,0,59,0.319264835,6.820455133,0.023157959
2007,6,1743,26012,0,1,1.91,0,58,0.207384938,6.844512984,0.020087012
2008,6,1743,26012,0,1,2.92,0,59,0.130632264,6.890964093,0.017103795
2009,6,1743,26012,0,1,3.92,0,60,0.112029325,6.879662342,0.017283796
2010,6,1743,30801,0,0,1,1,47,0.02804693,6.767971236,0.044755539
2005,7,1004,9249,0,0,9.65,0,53,0.076370794,6.596094672,0.31534354
2006,7,1004,9249,0,0,10.65,0,54,0.114891589,6.886346743,0.327808308
2007,7,1004,9249,0,0,11.65,0,55,0.097727719,6.973199328,0.307086799
2008,7,1004,9249,0,0,12.65,0,56,0.112119583,7.216716829,0.389800369
2009,7,1004,9249,0,0,13.65,0,57,0.086281135,7.228033526,0.331455792
2010,7,1004,9249,0,0,14.65,0,58,0.298922358,7.313914813,0.291147083",
sep=",",header=TRUE)

1 个答案:

答案 0 :(得分:0)

由于您的因变量Capex似乎是公司特定的指标,因此观察单位(= plm称为个体维度)可能是公司(变量CompanyID),在index参数中指定。

因此,基本的双向模型可以通过以下方式估算:

plm(Capex ~ CEO.background + MBA.CEO + CEO.Tenure + Female.CEO + CEO.age + Log.TA + Leverage, data=repexcapex, index = (c("CompanyID", "Year")), model = "within", effect = "twoways")

要添加行业固定效应,请在公式中包括+factor(Industry)。该变量可能会与其他固定效应相关联(这是针对您提供的小样本数据),因此可能会脱离估算值。