【发布时间】:2020-05-29 04:43:34
【问题描述】:
我想知道是否有一种方法可以更改 R 中 prop.test 函数的输出设置,以便它已经以百分比而不是小数显示置信区间?例如,我试图找出西方患有糖尿病的移民比例的 95% 置信区间。这是我的代码和输出:
sum(Immigrant_West$DIABETES)= 8, nrow(Immigrant_West)=144
prop.test(x=sum(Immigrant_West$DIABETES),n=nrow(Immigrant_West),conf.level = .95,correct=TRUE)
> 1-sample proportions test with continuity correction
data: sum(Immigrant_West$DIABETES) out of nrow(Immigrant_West), null probability 0.5
X-squared = 112, df = 1, p-value <2e-16
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.02606 0.11017
sample estimates:
p
0.05556
那么有没有办法将置信区间输出更改为显示 [2.606%, 11.017%] 而不是小数?谢谢!
【问题讨论】:
-
很容易编写自己的包装函数。
标签: r testing confidence-interval