在R中查看plm输出中的所有估计值

在R中查看plm输出中的所有估计值,r,output,lm,plm,panel-data,R,Output,Lm,Plm,Panel Data,我试着运行plm,看看正面、负面和中性类别对股价的影响 DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7") COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B") RET <- c(-2.0,1.1,3,1.4,-0.2, 0.6, 0.1, -0.21, -1.2, 0.9, 0.3, -0.

我试着运行
plm
,看看正面、负面和中性类别对股价的影响

DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7")
COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B")
RET <- c(-2.0,1.1,3,1.4,-0.2, 0.6, 0.1, -0.21, -1.2, 0.9, 0.3, -0.1,0.3,-0.12)
CLASS <- c("positive", "negative", "neutral", "positive", "positive", "negative", "neutral", "positive", "negative", "negative", "positive", "neutral", "neutral", "neutral")
df <- data.frame(DATE, COMP, RET, CLASS, stringsAsFactors=F)

df

#    DATE COMP   RET    CLASS
# 1     1    A -2.00 positive
# 2     2    A  1.10 negative
# 3     3    A  3.00  neutral
# 4     4    A  1.40 positive
# 5     5    A -0.20 positive
# 6     6    A  0.60 negative
# 7     7    A  0.10  neutral
# 8     1    B -0.21 positive
# 9     2    B -1.20 negative
# 10    3    B  0.90 negative
# 11    4    B  0.30 positive
# 12    5    B -0.10  neutral
# 13    6    B  0.30  neutral
# 14    7    B -0.12  neutral

DATE与大多数具有分类协变量的模型一样,第一个水平用作参考水平。在这种情况下,“负”类别用作参考类别,因为默认情况下,R按字母顺序对因子的级别进行排序。当你有一个分类数据,你不能真正梳理出具体的人的平均数和参考类别的平均数。它们被合并成截距项。那么,
CLASSneutral
的系数不是
neutral
类的效果,而是
neutral
negative
效果的不同。
CLASSpositive
——这是
positive
negative
效果的不同。因为模型默认使用单独的效果,每个人都有自己的截距,我假设这就是为什么他们没有在摘要上打印它的原因


这不是plm所独有的。同样的事情也会发生在标准的
lm

@MrFlick上:你知道如何构建一个截距,这样我就可以看到在“负”的情况下回报是多少吗?@cptn据我所知,你的模型为每个个体计算一个单独的截距项。在简单线性回归的情况下,没有单一的截距项可以估计。你所要求的没有道理。您无法获得每个级别的因子的效果。请使用fixef(mymodel)查看单个截取
mymodel <- plm(RET ~ CLASS, data=df,
              index = c("DATE", "COMP"), 
              model="within", 
              effect="time")

summary(mymodel)

# Oneway (time) effect Within Model

# Call:
# plm(formula = RET ~ CLASS, data = df, effect = "time", model = "within", 
#     index = c("DATE", "COMP"))

# Balanced Panel: n=7, T=2, N=14

# Residuals :
#    Min. 1st Qu.  Median 3rd Qu.    Max. 
# -2.1500 -0.4620 -0.0791  0.7540  1.9300 

# Coefficients :
#               Estimate Std. Error t-value Pr(>|t|)
# CLASSneutral   0.35818    0.81581  0.4390    0.670
# CLASSpositive -0.56418    0.81581 -0.6916    0.505

# Total Sum of Squares:    16.79
# Residual Sum of Squares: 14.694
# R-Squared      :  0.12486 
#       Adj. R-Squared :  0.089183 
# F-statistic: 0.713347 on 2 and 10 DF, p-value: 0.5133