R에서 수치형 데이터에 대한 추론
Mine Cetinkaya-Rundel
Associate Professor of the Practice, Duke University
연간 평균 income 대신 평균 hrly_rate를 비교합니다:
hrly_rate = income / (hrs_work * 52)데이터는 미국 시민권자와 비시민권자의 평균 시간당 임금 차이에 대한 설득력 있는 증거를 제공합니까?
$\mu = $ 평균 시간당 임금으로 정의
$H_0: \mu_{citizen} = \mu_{non-citizen}$
$H_A: \mu_{citizen} \ne \mu_{non-citizen}$
acs12 %>%
filter(!is.na(hrly_rate)) %>%
group_by(citizen) %>%
summarise(x_bar = round(mean(hrly_rate), 2),
s = round(sd(hrly_rate), 2),
n = length(hrly_rate))
citizen x_bar s n
1 no 21.19 34.50 58
2 yes 18.52 24.73 901
t.test(hrly_rate ~ citizen, data = acs12, null = 0,
alternative = "two.sided")
null = 0alternative = "two.sided"t.test(hrly_rate ~ citizen, data = acs12, null = 0,
alternative = "two.sided")
Welch Two Sample t-test
data: hrly_rate by citizen
t = 0.58058, df = 60.827, p-value = 0.5637
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-6.53483 11.88170
sample estimates:
mean in group no mean in group yes
21.19494 18.52151

R에서 수치형 데이터에 대한 추론