3. 会使用正确的统计检验方法来得到合理的结果。包括t.test, Wilcox.test, fisher.test, chisq.test,binom.test, ks.test, mcnemar.test,cor.test,var.test的使用条件。
X<-c(10.1, 10, 9.8, 10.5, 9.7, 10.1, 9.9, 10.2, 10.3, 9.9) interval_estimate1(X)
> t.test(X)
One Sample t-test data: X
t = 131.5854, df = 9, p-value = 4.296e-16
alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 9.877225 10.222775 sample estimates: mean of x 10.05
x<-rnorm(12, 501.1, 2.4) y<-rnorm(17, 499.7, 4.7)
interval_estimate2(x, y, var.equal=TRUE)
interval_estimate2(x, y)
> t.test(x, y)
Welch Two Sample t-test data: x and y
t = 0.1353, df = 23.949, p-value = 0.8935
alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.615842 2.982820 sample estimates: mean of x mean of y 499.4612 499.2777
t.test(x, y, var.equal=TRUE)
X<-c(11.3, 15.0, 15.0, 13.5, 12.8, 10.0, 11.0, 12.0, 13.0, 12.3) Y<-c(14.0, 13.8, 14.0, 13.5, 13.5, 12.0, 14.7, 11.4, 13.8, 12.0) t.test(X-Y)
X<-scan()
137.0 140.0 138.3 139.0 144.3 139.1 141.7 137.3 133.5 138.2 141.1 139.2 136.5 136.5 135.6 138.0 140.9 140.6 136.3 134.1
wilcox.test(X, mu=140, alternative=\exact=FALSE, correct=FALSE, conf.int=TRUE)
x<-c(459, 367, 303, 392, 310, 342, 421, 446, 430, 412) y<-c(414, 306, 321, 443, 281, 301, 353, 391, 405, 390) wilcox.test(x, y, alternative = \
> wilcox.test(x-y, alternative = \ Wilcoxon signed rank test data: x - y
V = 47, p-value = 0.02441
alternative hypothesis: true location is greater than 0
> binom.test(sum(x>y), length(x), alternative = \ Exact binomial test
data: sum(x > y) and length(x)
number of successes = 8, number of trials = 10, p-value = 0.05469
alternative hypothesis: true probability of success is greater than 0.5 95 percent confidence interval: 0.4930987 1.0000000 sample estimates:
probability of success 0.8