2. 평균차이 검정
t.test(
x,
y = NULL,
alternative = c("two.sided", "less", "greater"),
mu = 0,
paired = FALSE,
var.equal = FALSE,
conf.level = 0.95
)
간호 통계 이윤환, yoonani72@gmail.com
3. 평균차이 검정
> setwd("c://r_nur")
> delivery <- read.table("delivery.txt", header=TRUE)
> attach(delivery)
> t.test(time[type==2], time[type==1], var.equal=TRUE)
Welch Two Sample t-test
data: time[type == 2] and time[type == 1]
t = 2.3003, df = 24.777, p-value = 0.03013
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
0.1999658 3.6358431
sample estimates:
mean of x mean of y
10.473529 8.555625
간호 통계 이윤환, yoonani72@gmail.com
4. 일원배치 분산분석
> one.way <- read.table("fuel.txt", header=T)
> attach(one.way)
> Trt <- factor(trt)
> one.way.anova <- aov(y ~ Trt)
> summary.aov(one.way.anova)
> model.tables(one.way.anova)
> Tukey <- TukeyHSD(one.way.anova)
> print(Tukey,3)
> plot(Tukey)
R을 활용한 통계적 개념, 방법, 응용 – 허명회 저 중
간호 통계 이윤환, yoonani72@gmail.com
5. 분산분석표
Df Sum Sq Mean Sq F value Pr(>F)
Trt 3 1636.5 545.5 5.4063 0.006876 **
Residuals 20 2018.0 100.9
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
간호 통계 이윤환, yoonani72@gmail.com
6. 다중 비교
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = y ~ Trt)
$Trt
diff lwr upr p adj
2-1 13 -3.23 29.23 0.146
3-1 4 -12.23 20.23 0.900
4-1 -10 -26.23 6.23 0.338
3-2 -9 -25.23 7.23 0.427
4-2 -23 -39.23 -6.77 0.004
4-3 -14 -30.23 2.23 0.107
간호 통계 이윤환, yoonani72@gmail.com