R有特定的显著性代码来确定统计学上的显著性。例如,下面的例子中,点号.
表示在10%的水平上具有显著性(请参见下面的示例输出)。
点可能很难看到,尤其是当我将其复制粘贴到Excel中并在Times New Roman中显示时。
我想改变它,使得:
*
= 10%的显着性**
= 5%的显着性***
= 1%的显着性
我能做到这一点吗?
> y = c(1,2,3,4,5,6,7,8)
> x = c(1,3,2,4,5,6,8,7)
> summary(lm(y~x))
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-1.0714 -0.3333 0.0000 0.2738 1.1191
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.2143 0.6286 0.341 0.74480
x 0.9524 0.1245 7.651 0.00026 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.8067 on 6 degrees of freedom
Multiple R-squared: 0.907, Adjusted R-squared: 0.8915
F-statistic: 58.54 on 1 and 6 DF, p-value: 0.0002604
stats:::printCoefmat
打印的,其中硬编码了这些值。您可以通过调用symnum()
使用自己的符号格式化 p 值,但是summary.lm
的默认选项似乎无法配置。你真的要将这些结果粘贴到 Excel 中吗?呸。 - MrFlicklm
摘要报告中删除它们,尽管我目前找不到这些参考文献。 - r2evans