如何改变显着的标志?

时间:2016-01-18 03:52:58

标签: r

当我使用lm函数时,summary会显示:

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

data(mtcars)
fit1 <- lm(mpg~cyl+disp+hp+wt,data=mtcars)
summary(fit1)

我想使用0.01 ***,0.05 **,0.1*,1 ' '

sink("printCoefmat.R") 
printCoefmat 
sink()

我关注this page,添加

cutpoints = c(0, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", " "))

并对'printCoefmat.R'文件进行一些更改, 然后,我用:

source("printCoefmat.R")

但它不起作用。

summary(fit1)

仍然表明:

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 40.82854    2.75747  14.807 1.76e-14 ***
cyl         -1.29332    0.65588  -1.972 0.058947 .  
disp         0.01160    0.01173   0.989 0.331386    
hp          -0.02054    0.01215  -1.691 0.102379    
wt          -3.85390    1.01547  -3.795 0.000759 ***
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.513 on 27 degrees of freedom
Multiple R-squared:  0.8486,    Adjusted R-squared:  0.8262 
F-statistic: 37.84 on 4 and 27 DF,  p-value: 1.061e-10

我想更改lm的输出:

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

成:

Signif. codes:  0.01 ‘***’ 0.05 ‘**’ 0.1 ‘*’

我希望输出如下:

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 40.82854    2.75747  14.807 1.76e-14 ***
cyl         -1.29332    0.65588  -1.972 0.058947 *  
disp         0.01160    0.01173   0.989 0.331386    
hp          -0.02054    0.01215  -1.691 0.102379    
wt          -3.85390    1.01547  -3.795 0.000759 ***
Signif. codes:  0.01 ‘***’ 0.05 ‘**’ 0.1 ‘*’
Residual standard error: 2.513 on 27 degrees of freedom
Multiple R-squared:  0.8486,    Adjusted R-squared:  0.8262 
F-statistic: 37.84 on 4 and 27 DF,  p-value: 1.061e-10

0 个答案:

没有答案