【发布时间】:2016-05-25 23:08:54
【问题描述】:
我可以在使用汇总命令时获得显着的系数。在这里,通过查看星星,我看到 Sepal.Width 和 Petal.Length 的 P 值要低得多。但是,如果我只打印出系数,这些星星就会消失。怎么把星星找回来? (注意:我想要输出中的星星。)
library(plm)
m1 = plm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=iris, index=c('Species'))
summary(m1)
Oneway (individual) effect Within Model
Call:
plm(formula = Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width,
data = iris, index = c("Species"))
Balanced Panel: n=3, T=50, N=150
Residuals :
Min. 1st Qu. Median 3rd Qu. Max.
-0.79400 -0.21900 0.00899 0.20300 0.73100
Coefficients :
Estimate Std. Error t-value Pr(>|t|)
Sepal.Width 0.495889 0.086070 5.7615 4.868e-08 ***
Petal.Length 0.829244 0.068528 12.1009 < 2.2e-16 ***
Petal.Width -0.315155 0.151196 -2.0844 0.03889 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Total Sum of Squares: 38.956
Residual Sum of Squares: 13.556
R-Squared: 0.65201
Adj. R-Squared: 0.62593
F-statistic: 89.9338 on 3 and 144 DF, p-value: < 2.22e-16
在这里,我尝试仅打印出系数。我的重要明星不见了。
summary(m1)$coeff
Estimate Std. Error t-value Pr(>|t|)
Sepal.Width 0.4958889 0.08606992 5.761466 4.867516e-08
Petal.Length 0.8292439 0.06852765 12.100867 1.073592e-23
Petal.Width -0.3151552 0.15119575 -2.084418 3.888826e-02
【问题讨论】:
-
@Pascal 谢谢你的链接。但是,我想要所有的输出,我只想要它们旁边的星星。我正在查看源代码,我只是不明白为什么星星会消失。
-
星号显示在 summary 对象的
print方法中。当你使用coef时,它完全是另外一头野兽。在摘要下,解释了星号(和圆点)。重新创建它们很容易,但问题是 - 为什么?你有准确的 p 值。尽其所能。 -
你可能想看看包
pixiedust来格式化输出。 GitHub 上的页面有一个带有星号的示例,可以容纳您正在寻找的内容:github.com/nutterb/pixiedust
标签: r regression plm coefficients