prop.test以百分比形式显示置信区间,而不是R中的十进制?

问题描述 投票:0回答:1

我想知道是否有一种方法可以更改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
1个回答
0
投票

不容易。打印格式由print.htest()功能控制,该功能记录在?print.htest中:除位数和“方法”组件的前缀外,它似乎没有提供任何其他选项。

如果需要,您可以自己修改该功能。 (接下来可能会有更多详细信息;将stats:::print.htest转储到文件中,然后对其进行编辑,然后再source()。)>

© www.soinside.com 2019 - 2024. All rights reserved.