gpt4 book ai didi

r - 控制回归后fit summary的数字显示

转载 作者:行者123 更新时间:2023-12-02 08:34:56 24 4
gpt4 key购买 nike

如何控制summary(fit)的数字显示,现在小数点后显示的数字太多了。尝试使用 options(digits=3),但它不起作用

> fit <- lm(y ~ x1 + x2 + x3)
> summary(fit) # show results

最佳答案

fit <- lm(mpg~wt,mtcars)
print(summary(fit),digits=2)

# Call:
# lm(formula = mpg ~ wt, data = mtcars)

# Residuals:
# Min 1Q Median 3Q Max
# -4.54 -2.36 -0.13 1.41 6.87

# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 37.29 1.88 19.9 <2e-16 ***
# wt -5.34 0.56 -9.6 1e-10 ***
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# Residual standard error: 3 on 30 degrees of freedom
# Multiple R-squared: 0.75, Adjusted R-squared: 0.74
# F-statistic: 91 on 1 and 30 DF, p-value: 1.3e-10

关于r - 控制回归后fit summary的数字显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22670709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com