method x LowerLimit UpperLimit LowerAbb UpperAbb ZWI
1 Wald 778 0.4943974 0.5450148 NO NO NO
2 ArcSine 778 0.4943829 0.5449787 NO NO NO
3 Likelihood 778 0.4943405 0.5449894 NO NO NO
4 Score 778 0.4943793 0.5449320 NO NO NO
5 Logit-Wald 778 0.4943685 0.5449427 NO NO NO
6 Wald-T 778 0.4943973 0.5450148 NO NO NO
Alternative R package
library(binom)binom.confint(778, 1497, conf.level=0.95, method="asymptotic") # Wald CI
method x n mean lower upper
1 asymptotic 778 1497 0.5197061 0.4943974 0.5450148
zCI<-function(x, conf.level=0.95){# x: vector of the sample valuesmean(x)+c(-1,1)*qnorm((1+conf.level)/2)*sqrt(var(x)/length(x)) }UN <-read.table("http://stat4ds.rwth-aachen.de/data/UN.dat", header=TRUE) # We revisit the UN data filenames(UN)
Two Sample t-test
data: cogbehav and control
t = 1.676, df = 53, p-value = 0.09963
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.680137 7.593930
sample estimates:
mean of x mean of y
3.006897 -0.450000
t.test(cogbehav,control) # not assuming equal population standard deviations
Welch Two Sample t-test
data: cogbehav and control
t = 1.6677, df = 50.971, p-value = 0.1015
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.7044632 7.6182563
sample estimates:
mean of x mean of y
3.006897 -0.450000
# Alternative approachlibrary(DescTools)MeanDiffCI(cogbehav,control)
2-sample test for equality of proportions without continuity correction
data: c(315, 304) out of c(604, 597)
X-squared = 0.18217, df = 1, p-value = 0.6695
alternative hypothesis: two.sided
95 percent confidence interval:
-0.04421536 0.06883625
sample estimates:
prop 1 prop 2
0.5215232 0.5092127
library(PropCIs) # uses binomial success count and n for each groupdiffscoreci(315,604,304,597, conf.level=0.95) # 95% confidence interval for pi_1-pi_2