Laboratory of Microbial Genomics and Big Data (강원대학교 미생물유전체빅데이터 연구실)

R: Statistics - Student's t-Test - by Eun Bae Kim (12/01/2018)
 Visits : 497,906 ( Your IP 3.143.17.175 )
 

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
# T-test #####################################################################
genes = c(5, 6, 5, 4, 3, 4, 5, 1, 0, 1, 2, 1, 0, 0)
group = c(1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2)
t.test(genes~group)
boxplot(genes~group, ylim=c(0,10))
t.test(genes~group, alternative='greater')
t.test(genes~group, alternative='less')

group1 = c(20,23,24,22,19,23,23,25)
group2 = c(28,26,27,28,27,28,26,28,28,29,24)

t.test(group1, group2)
t.test(group1, group2, alternative = c("two.sided"))
t.test(group1, group2, alternative = c("less"))
t.test(group1, group2, alternative = c("greater"))

# Paired T-test
before = c(20,23,24,22,19,23,23,25)
after  = c(28,26,27,28,27,28,26,28)

t.test(before, after)
t.test(before, after, paired=TRUE, alternative = "less")
t.test(before, after, paired=TRUE)


Figure 1. R: Statistics - Student's t-Test


Figure 2. R: Statistics - Student's t-Test


Kangwon National University