简体   繁体   English

从plm模型(R)中提取单个系数

[英]Extract individual coefficients from plm model (R)

I would like to ask if it is possible to extract coefficients for individual observations for a given variable in panel data using plm in R, for instance using the example data: 我想问一下是否有可能使用R中的plm提取面板数据中给定变量的单个观测值的系数,例如使用示例数据:

wi <- plm(inv ~ value + capital, data = Grunfeld, model = "within", effect = "twoways")

In other words, in this example a coefficient for each of the firms in the sample. 换句话说,在此示例中,样本中每个公司的系数。

I think you're looking for the function fixef in the plm package, which extracts the "fixed effects" (firm coefficients in this case). 我认为您在plm包中寻找功能fixef ,该功能提取了“固定效果”(在这种情况下为固定系数)。 In your example: 在您的示例中:

library(plm)
data("Grunfeld")
wi <- plm(inv ~ value + capital, data = Grunfeld, model = "within", effect = "twoways")

and then run: 然后运行:

> fixef(wi)
          1           2           3           4           5           6           7           8           9 
-134.227709   72.826531 -269.458508  -38.873866 -139.666304  -31.339066  -82.761099  -66.737194 -104.010153 
         10 
  -7.390586 

It is not clear to me what you are looking for: 我不清楚您在寻找什么:

1) "coefficients for individual observations" 1)“个人观察系数”

vs.

2) "a coefficient for each of the firms" . 2)“每个厂商的系数”。

These are two different things and I believe you cannot have neither. 这是两件不同的事情,我相信您不可能都没有。

1) Asking for more than one coefficient for one observation does not work. 1)对于一个观测值要求不止一个系数是行不通的。

2) Asking for one coefficient per firm but trying to estimate two ( value and capital ) does not seem plausible. 2)每个公司要求一个系数,但试图估计两个系数( valuecapital )似乎是不合理的。

Maybe this answer gives what you are looking for: Extract all individual slope coefficient from pooled OLS estimation in R 也许这个答案可以满足您的需求: 从R中的汇总OLS估计中提取所有单个斜率系数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM