User Tools

Site Tools


r:anova

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
r:anova [2023/06/05 19:27] – [ANOVA in R] hkimscilr:anova [2024/04/17 08:29] – [ANOVA in R: Output] hkimscil
Line 283: Line 283:
 [1] 56.7234 [1] 56.7234
  
 +> # within part 구하기
 +> # 간단한 방법
 +> tapply(comb3$values, comb3$group, var)*15
 +  a     
 +600 750 900 
 +> sse <- sum(tapply(comb3$values, comb3$group, var)*15)
 +> sse
 +[1] 2250
 +
 +> # 이해한 개념대로 얼른 구하기
 > # A, B, C 평균 > # A, B, C 평균
 > m.a <- mean(A) > m.a <- mean(A)
Line 300: Line 310:
  
 > ss.within <- ss.a + ss.b + ss.c > ss.within <- ss.a + ss.b + ss.c
-> ss.within <- ss.within+> ss.within == sse # check both are the same 
 +[1] TRUE 
 +
  
 +> # between part 구하기
 > 16*((m.a-mean.tot)^2) > 16*((m.a-mean.tot)^2)
 [1] 144 [1] 144
Line 359: Line 372:
 --- ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +
 +</code>
 +
 +<code>
 > # 위에서  > # 위에서 
 > # ssd라는 function을 만들면  > # ssd라는 function을 만들면 
Line 365: Line 383:
 +     var(x) * (length(x)-1) } +     var(x) * (length(x)-1) }
 > ss.a1 <- ssd(A) > ss.a1 <- ssd(A)
-> ss.b2 <- ssd(B)+> ss.b1 <- ssd(B)
 > ss.c1 <- ssd(C) > ss.c1 <- ssd(C)
  
Line 374: Line 392:
 > ss.c == ss.c1 > ss.c == ss.c1
 [1] TRUE [1] TRUE
-> # 그러나 정확히 어떤 그룹에서 차이가 나는지는 판단해주지 않음  
-> pairwise.t.test(comb3$values, comb3$group, p.adj = "none") 
- 
- Pairwise comparisons using t tests with pooled SD  
- 
-data:  comb3$values and comb3$group  
- 
-  a      b      
-b 0.4279 -      
-c 0.0075 0.0516 
- 
-P value adjustment method: none  
-> # OR 
-> pairwise.t.test(comb3$values, comb3$group, p.adj = "bonf") 
- 
- Pairwise comparisons using t tests with pooled SD  
- 
-data:  comb3$values and comb3$group  
- 
-  a         
-b 1.000 -     
-c 0.023 0.155 
- 
-P value adjustment method: bonferroni  
-> pairwise.t.test(comb3$values, comb3$group, p.adj = "holm") 
- 
- Pairwise comparisons using t tests with pooled SD  
- 
-data:  comb3$values and comb3$group  
- 
-  a         
-b 0.428 -     
-c 0.023 0.103 
- 
-P value adjustment method: holm  
  
-# OR TukeyHSD(anova.output) +</code>
-> TukeyHSD(a.res) +
-  Tukey multiple comparisons of means +
-    95% family-wise confidence level+
  
-Fit: aov(formula = values ~ group, data = comb3) +<code>
- +
-$group +
-    diff        lwr       upr     p adj +
-b-a   -2  -8.059034  4.059034 0.7049466 +
-c-a   -7 -13.059034 -0.940966 0.0201250 +
-c-b   -5 -11.059034  1.059034 0.1238770 +
- +
->  +
->  +
-+
 </code> </code>
- 
 ====== Post hoc test ====== ====== Post hoc test ======
 [[:post hoc test]] [[:post hoc test]]
r/anova.txt · Last modified: 2024/04/17 08:30 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki