UPDATE: 2024-03-27 23:07:31.978447
ここでは、比率の差の検定とχ二乗検定の書き換えについてのメモを残しておく。関数の使い方をすぐ忘れてしまうので。
# Group A
# 7/100
numerator_a <- 7
denominator_a <- 100
# Group B
# 15/100
numerator_b <- 15
denominator_b <- 100
x <- c(numerator_a, numerator_b)
n <- c(denominator_a, denominator_b)
mat <- cbind(x = x, y = n-x)
list(
numerator = x,
denominator = n,
matrix = mat
)
## $numerator
## [1] 7 15
##
## $denominator
## [1] 100 100
##
## $matrix
## x y
## [1,] 7 93
## [2,] 15 85
##
## 2-sample test for equality of proportions without continuity correction
##
## data: x out of n
## X-squared = 3.2686, df = 1, p-value = 0.07062
## alternative hypothesis: two.sided
## 95 percent confidence interval:
## -0.166015404 0.006015404
## sample estimates:
## prop 1 prop 2
## 0.07 0.15
##
## Pearson's Chi-squared test
##
## data: mat
## X-squared = 3.2686, df = 1, p-value = 0.07062