繁体   English   中英

如何计算 R 中向量的置信区间(使用“binom.confint”)?

[英]How to calculate the confidence interval (using “binom.confint”) for a vector in R?

我正在尝试使用binom.confint计算均值周围的置信区间。

我的数据以百分比表示,如下所示:

data<-c(56.8, 34.9, 45.3, 52.3, 48.6, 51.5, 45.2,55.2,40.4,42.7)
and n=10

我一直在查看其他 R 脚本,但其中大多数使用以下语法:

 library(binom)
 binom.confint(x, n, conf.level = 0.95) # here I think X represent each single data points NOT the whole vector (e.g. data).

关于如何进行的任何想法?

计算 Student t检验的 function t.test()给出置信区间:

> data<-c(56.8, 34.9, 45.3, 52.3, 48.6, 51.5, 45.2,55.2,40.4,42.7)
> t.test(data)

    One Sample t-test

data:  data
t = 21.687, df = 9, p-value = 4.44e-09
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 42.35727 52.22273
sample estimates:
mean of x 
    47.29 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM