5 Paired Ttest FT read csvFT csv withFT

  • Slides: 10
Download presentation

###### 5장: Paired T-test ### 데이타를 읽어 정규성 검정 FT = read. csv("FT. csv")

###### 5장: Paired T-test ### 데이타를 읽어 정규성 검정 FT = read. csv("FT. csv") with(FT, shapiro. test(Postwt-Prewt)) ### paired t-test는 기본적으로 One sample t-test이 다. with(FT, t. test(Postwt-Prewt)) ## 다음 명령어들도 동일한 결과를 얻음 t. test(FT$Postwt-FT$Prewt) with(FT, t. test(Postwt, Prewt, paired=TRUE)) 2012 -09 -14 2

### 선택하기 anorexia = read. csv("anorexia. csv") anorexia[c(1, 3), ] anorexia[, c(1, 2)] anorexia[c(1,

### 선택하기 anorexia = read. csv("anorexia. csv") anorexia[c(1, 3), ] anorexia[, c(1, 2)] anorexia[c(1, 3), c(1, 2)] anorexia$Treat=="FT" anorexia[anorexia$Treat=="FT", ] anorexia$Treat %in% c("Cont", "FT") anorexia[anorexia$Treat %in% c("Cont", "FT"), ] anorexia$Treat != "CBT" anorexia[anorexia$Treat != "CBT", ] 2012 -09 -14 3

### Subset 분석 # 두 명령어의 결과는 동일하다. with(FT, t. test(Postwt-Prewt)) with(anorexia[anorexia$Treat=="FT", ], t.

### Subset 분석 # 두 명령어의 결과는 동일하다. with(FT, t. test(Postwt-Prewt)) with(anorexia[anorexia$Treat=="FT", ], t. test(Postwt-Prewt)) 2012 -09 -14 4

### Simulation library(MASS) matrix(c(10, 6, 6, 10), ncol=2) set. seed(1234) x = mvrnorm(n=10, mu=c(94,

### Simulation library(MASS) matrix(c(10, 6, 6, 10), ncol=2) set. seed(1234) x = mvrnorm(n=10, mu=c(94, 93), Sigma=matrix(c(10, 6, 6, 10), ncol=2)) t. test(x[, 2]-x[, 1]) # 다음 명령어의 결과도 동일하다. t. test(x[, 2], x[, 1], paired=TRUE) 2012 -09 -14 5

### 연습 Cont = anorexia[anorexia$Treat=="Cont", ] with(Cont, shapiro. test(Postwt-Prewt)) with(Cont, t. test(Postwt-Prewt)) 2012 -09

### 연습 Cont = anorexia[anorexia$Treat=="Cont", ] with(Cont, shapiro. test(Postwt-Prewt)) with(Cont, t. test(Postwt-Prewt)) 2012 -09 -14 6

##### 6장 Wilcoxon Signed-Rank Test # 정규성 검정 CBT=read. csv("CBT. csv") with(CBT, shapiro. test(Postwt-Prewt))

##### 6장 Wilcoxon Signed-Rank Test # 정규성 검정 CBT=read. csv("CBT. csv") with(CBT, shapiro. test(Postwt-Prewt)) # Wilcoxon signed rank test with(CBT, wilcox. test(Postwt-Prewt)) 2012 -09 -14 8

# Warning 없애기 with(CBT, wilcox. test(Postwt-Prewt, exact=FALSE)) # 정규분포를 만족시키지않는 데이타를 Ttest with(CBT, t.

# Warning 없애기 with(CBT, wilcox. test(Postwt-Prewt, exact=FALSE)) # 정규분포를 만족시키지않는 데이타를 Ttest with(CBT, t. test(Postwt-Prewt)) 2012 -09 -14 9

### 6장 연습문제 답 다음과 같이 Treat가 CBT인 관찰치만 고를수 있습니다. anorexia[anorexia$Treat=="CBT", ] 다음과

### 6장 연습문제 답 다음과 같이 Treat가 CBT인 관찰치만 고를수 있습니다. anorexia[anorexia$Treat=="CBT", ] 다음과 같이 정규성 검정을 하고 with(anorexia[anorexia$Treat=="CBT", ], shapiro. test(Postwt-Prewt)) 다음과 같이 Wilcoxon signed-rank test를 합니다. with(anorexia[anorexia$Treat=="CBT", ], wilcox. test(Postwt-Prewt)) 2012 -09 -14 10

2012 -09 -14 11

2012 -09 -14 11