User Tools

Site Tools


r:oneway_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
r:oneway_anova [2020/10/12 16:32] hkimscilr:oneway_anova [2022/04/28 10:26] (current) – [data] hkimscil
Line 1: Line 1:
 ====== Oneway ANOVA ====== ====== Oneway ANOVA ======
 +===== data =====
 +see https://github.com/hkimscil/ms/blob/main/anova.R
 +
 | (온도조건)x1  | 50.5  | 52.1  | 51.9  | 52.4  | 50.6  | 51.4  | 51.2  | 52.2  | 51.5  | 50.8  | | (온도조건)x1  | 50.5  | 52.1  | 51.9  | 52.4  | 50.6  | 51.4  | 51.2  | 52.2  | 51.5  | 50.8  |
 | (온도조건)x2  | 47.5  | 47.7  | 46.6  | 47.1  | 47.2  | 47.8  | 45.2  | 47.4  | 45.0  | 47.9  | | (온도조건)x2  | 47.5  | 47.7  | 46.6  | 47.1  | 47.2  | 47.8  | 45.2  | 47.4  | 45.0  | 47.9  |
Line 160: Line 163:
 30  46.2   hi 30  46.2   hi
 </code> </code>
 +===== ANOVA by hand =====
 <code> <code>
 mean.by.group.xs <- tapply(xs$score, xs$temp, mean) mean.by.group.xs <- tapply(xs$score, xs$temp, mean)
Line 261: Line 264:
 > ss.between + ss.within > ss.between + ss.within
 [1] 175.695 [1] 175.695
 +
 +> ms.between <- ss.between/df.between
 +> ms.within <- ss.within/df.within
 +> ms.total <- ss.total/df.total
 +
 +> ms.total
 +[1] 6.058448
 +> ms.between
 +[1] 78.151
 +> ms.within
 +[1] 0.7182593
 +
 +> f.calculated <- ms.between/ms.within
 +> f.calculated
 +[1] 108.8061
 +> var(xs$score)
 +[1] 6.058448
  
 </code> </code>
 +===== ANOVA function (aov) =====
  
 <code> <code>
Line 305: Line 326:
  
 > </code> > </code>
- 
-<code>> tapply(xs$values, xs$ind, mean) 
-   x1    x2    x3  
-51.46 46.94 46.35 </code> 
- 
- 
-SS<sub>between</sub> 
-<code>> meanxs <- mean(xs$values) 
-> mx1 <- mean(x1) 
-> mx2 <- mean(x2) 
-> mx3 <- mean(x3) 
- 
-> x2ss <- 10*((meanxs - mx2)^2) 
-> x3ss <- 10*((meanxs - mx3)^2) 
-> x1ss <- 10*((meanxs - mx1)^2) 
-> xss <- x1ss+x2ss+x3ss 
-> xss 
-[1] 156.302 
-</code> 
- 
  
 ====== E.g. 1 ====== ====== E.g. 1 ======
r/oneway_anova.1602487942.txt.gz · Last modified: 2020/10/12 16:32 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki