R로 배우는 A/B Testing
Lauryn Burleigh
Data Scientist

스피어만 상관(rho): 단조 관계
단조는 선형보다 덜 제한적
ggplot(data, aes(x = drownings,
y = icecream)) +
geom_point()


library(pwr)
pwr.r.test(r = 0.3, power = 0.80,
sig.level = 0.05)
상관관계 검정력 근사치
계산 (arctangh 변환)
n = 84.07364
r = 0.3
sig.level = 0.05
power = 0.8
alternative = two.sided
cor.test(~ enjoyment + time,
data = pizza,
method = "spearman",
exact = FALSE)
스피어만 순위 상관 rho
data: time and enjoyment
S = 2, p-value = .003245
대립가설: 실제 rho는 0이 아님
표본 추정치:
rho
0.9984962
samp <- length(pizza$time)
[1] 90
cor.test(~ enjoyment + time,
data = pizza,
subset =
(Topping == "Cheese"),
method = "spearman",
exact = FALSE)
스피어만 순위 상관 rho
data: time and enjoyment
S = 1.2434e-14, p-value = 0.0003968
대립가설: 실제 rho는 0이 아님
표본 추정치:
rho
1
ggplot(pizza, aes(x = enjoyment,
y = time,
color = Topping)) +
geom_point()

library(pwr)
pwr.r.test(r = 0.998, n = 90,
sig.level = 0.003)
상관관계 검정력 근사치
계산 (arctangh 변환)
n = 90
r = 0.998
sig.level = 0.003
power = 1
alternative = two.sided
rhotest <- cor.test(~ enjoyment + time,
data = pizza,
method = "spearman")
samp <- length(pizza$time)
library(pwr)
pwr.r.test(r = rhotest$estimate,
sig.level = rhotest$p.value,
n = samp)
상관관계 검정력 근사치
계산 (arctangh 변환)
n = 90
r = 0.998
sig.level = 0.003
power = 1
alternative = two.sided
R로 배우는 A/B Testing