User Tools

Site Tools


factorial_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
factorial_anova [2020/05/29 17:24] – [예 1] hkimscilfactorial_anova [2024/05/01 08:36] (current) – [Materials and links] hkimscil
Line 289: Line 289:
 detergent 는 세탁의 정도를 세제의 종류와 물온도를 독립변인으로 (팩터로) 가설검증을 한 것이다. 데이터는 위의 {{detergent.csv}} 이다. 또한 손으로 Factorial ANOVA를 하기 위해 이 데이터를 엑셀에 정리하여 {{:detergent.anova.by.hand.xlsx}}로 올려 두었다. detergent 는 세탁의 정도를 세제의 종류와 물온도를 독립변인으로 (팩터로) 가설검증을 한 것이다. 데이터는 위의 {{detergent.csv}} 이다. 또한 손으로 Factorial ANOVA를 하기 위해 이 데이터를 엑셀에 정리하여 {{:detergent.anova.by.hand.xlsx}}로 올려 두었다.
  
 +<code>
 +de <- read.csv("http://commres.net/wiki/_media/detergent.csv", sep = ",", header=T)
 +de 
  
 +de$type <- factor(de$type, level=c(1,2), label=c("super", "best"))
 +de$w.temp <- factor(de$w.temp, level=c(1,2,3), label=c("cold", "warm", "hot"))
 +de
 +
 +de.anova <- aov(cleanness ~ type * w.temp, data=de)
 +summary(de.anova)
 +
 +with(de, interaction.plot(x.factor=type, 
 +  trace.factor=w.temp, response=cleanness, 
 +  fun=mean, type="b", legend=T,
 +  ylab="cleanness", main="Interaction Plot (type by temp)",
 +  pch=c(1,19)))
 +  
 +
 +</code>
 +
 +<code>
 +> de <- read.csv("http://commres.net/wiki/_media/detergent.csv", sep = ",", header=T)
 +> de 
 +   type w.temp cleanness
 +1          1         4
 +2          1         5
 +3          1         6
 +4          1         5
 +5          1         6
 +6          1         6
 +7          1         4
 +8          1         4
 +9          2         7
 +10    1      2         9
 +11    1      2         8
 +12    1      2        10
 +13    2      2        13
 +14    2      2        15
 +15    2      2        12
 +16    2      2        12
 +17    1      3        10
 +18    1      3        12
 +19    1      3        11
 +20    1      3         9
 +21    2      3        12
 +22    2      3        13
 +23    2      3        10
 +24    2      3        13
 +> de$type <- factor(de$type, level=c(1,2), label=c("super", "best"))
 +> de$w.temp <- factor(de$w.temp, level=c(1,2,3), label=c("cold", "warm", "hot"))
 +> de
 +    type w.temp cleanness
 +1  super   cold         4
 +2  super   cold         5
 +3  super   cold         6
 +4  super   cold         5
 +5   best   cold         6
 +6   best   cold         6
 +7   best   cold         4
 +8   best   cold         4
 +9  super   warm         7
 +10 super   warm         9
 +11 super   warm         8
 +12 super   warm        10
 +13  best   warm        13
 +14  best   warm        15
 +15  best   warm        12
 +16  best   warm        12
 +17 super    hot        10
 +18 super    hot        12
 +19 super    hot        11
 +20 super    hot         9
 +21  best    hot        12
 +22  best    hot        13
 +23  best    hot        10
 +24  best    hot        13
 +> de.anova <- aov(cleanness ~ type * w.temp, data=de)
 +> summary(de.anova)
 +            Df Sum Sq Mean Sq F value   Pr(>F)    
 +type             24   24.00   15.43 0.000986 ***
 +w.temp          193   96.50   62.04 8.41e-09 ***
 +type:w.temp  2     21   10.50    6.75 0.006496 ** 
 +Residuals   18     28    1.56                     
 +---
 +Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 +
 +> with(de, interaction.plot(x.factor=type, 
 ++                           trace.factor=w.temp, response=cleanness, 
 ++                           fun=mean, type="b", legend=T,
 ++                           ylab="cleanness", main="Interaction Plot (type by temp)",
 ++                           pch=c(1,19)))
 +
 +
 +</code>
 +{{:pasted:20240429-083635.png}}
 +
 +만약에 손으로 계산했다면 R에서 
 +<code>
 +pf(15.43, 1, 18, lower.tail=F)
 +pf(62.04, 2, 18, lower.tail=F)
 +pf(6.75, 2, 18, lower.tail=F)
 +
 +
 +</code>
 +<code>
 +> pf(15.43, 1, 18, lower.tail=F)
 +[1] 0.000985713
 +> pf(62.04, 2, 18, lower.tail=F)
 +[1] 8.40729e-09
 +> pf(6.75, 2, 18, lower.tail=F)
 +[1] 0.006496173
 +
 +> </code>
  
-===== 예 =====+===== 예 2.  cookie experiment =====
   * {{:AnovaData.sav}} SPSS 데이터    * {{:AnovaData.sav}} SPSS 데이터 
  
Line 302: Line 414:
 $SS_{total}=\Sigma{X^2}-\frac{G^2}{N}$ $SS_{total}=\Sigma{X^2}-\frac{G^2}{N}$
 $SS_{\text{between}}=\Sigma{\frac{T^2}{n}}-\frac{G^2}{N}$ $SS_{\text{between}}=\Sigma{\frac{T^2}{n}}-\frac{G^2}{N}$
-$SS_{within} \Sigma{SS_{each \treatment}} $+$SS_{\text{within}= \Sigma{SS_{\text{each treatment}}} $
  
-$df_{between} k - 1$ +$df_{\text{between} k - 1$ 
-$df_{within} \Sigma{df_{each \; treatment}} $+$df_{\text{within}= \Sigma{df_{each \; treatment}} $
  
 $SS_{total} = SS_{between} + SS_{within}$ $SS_{total} = SS_{between} + SS_{within}$
Line 346: Line 458:
  
   * $SS_{within}$   * $SS_{within}$
-    * $SS_{within} = \Sum{SS_{within}} = 1502 + 940 + 1062 + 1084 = 4588$+    * $SS_{within} = \Sigma{SS_{within}} = 1502 + 940 + 1062 + 1084 = 4588$
   * $SS_{between}$   * $SS_{between}$
     * $SS_{between} = 5108 - 4588 = 520 $     * $SS_{between} = 5108 - 4588 = 520 $
   * $SS_A$   * $SS_A$
   * $SS_B$   * $SS_B$
-  * $SS_{AxB}$+  * $SS_{\text{AxB}}$
 MS MS
   * $MS_{A}$   * $MS_{A}$
   * $MS_{B}$   * $MS_{B}$
-  * $MS_{AxB}$+  * $MS_{\text{AxB}}$
   * $MS_{Within}$   * $MS_{Within}$
 F-ratio F-ratio
   * $F_{A}$   * $F_{A}$
   * $F_{B}$   * $F_{B}$
-  * $F_{AxB}$+  * $F_{\text{AxB}}$
  
 Tests of Between-Subjects Effects  Tests of Between-Subjects Effects
Line 374: Line 486:
 | Corrected Total  | 5108.000  | 79  |       | | Corrected Total  | 5108.000  | 79  |       |
 | a R Squared = .102 (Adjusted R Squared = .066)  |||||| | a R Squared = .102 (Adjusted R Squared = .066)  ||||||
 +
 +데이터 파일
 +{{:r:cookies.csv}}
 +손으로 계산하기
 +{{:r:cookies.xlsx}}
  
 <code> <code>
Line 588: Line 705:
 +                                pch=c(1,19))) +                                pch=c(1,19)))
  
 +</code>
 +
 +{{:pasted:20200602-132951.png}}
 +<code>
 > cookies.aov <- aov(ncookies ~ weight * fullness, data=cookies) > cookies.aov <- aov(ncookies ~ weight * fullness, data=cookies)
 > summary(cookies.aov) > summary(cookies.aov)
Line 600: Line 721:
 </code> </code>
 ===== Interpreting interaction ===== ===== Interpreting interaction =====
 +위에서 두개 독립변인에 대한 주효과가 없었으므로 각 독립변인의 종류 (특성) 별로 어디에서 차이가 났는가를 살피는 것은 의미가 없음. 따라서 아래는 필요한 절차가 아님. 
 <code>> TukeyHSD(cookies.aov, which="weight") <code>> TukeyHSD(cookies.aov, which="weight")
   Tukey multiple comparisons of means   Tukey multiple comparisons of means
Line 637: Line 759:
 ====== Materials and links ====== ====== Materials and links ======
   * {{:AnovaData.sav}}   * {{:AnovaData.sav}}
-  * http://www.uwsp.edu/psych/stat/13/anova-2w.htm  
  
-  * http://faculty.vassar.edu/lowry/ch16pt1.html 
-  * http://faculty.vassar.edu/lowry/ch16pt2.html 
-  * http://faculty.vassar.edu/lowry/ch16pt3.html 
-  * http://faculty.vassar.edu/lowry/ch16pt4.html 
-  * http://faculty.vassar.edu/lowry/ch16pt5.html 
  
  
-{{tag>factorial anova, statisticsTwo-Factor Analysis of Variance, 팩토리얼 아노바, 상호작용효과, 주효과}}+{{tag>factorial_anova statistics Two-Factor_Analysis_of_Variance, 팩토리얼 아노바, 상호작용효과, 주효과}}
factorial_anova.1590740687.txt.gz · Last modified: 2020/05/29 17:24 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki