User Tools

Site Tools


r:twoway_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:twoway_anova [2018/05/23 09:04] – [E.g. 1] hkimscilr:twoway_anova [2018/10/19 08:39] (current) – [e.g. 5] hkimscil
Line 218: Line 218:
 [{{:r:interaction effect eg04.png|Interaction effect example 4}}] [{{:r:interaction effect eg04.png|Interaction effect example 4}}]
  
-===== 5 =====+===== e.g., 5 =====
 download {{:r:dataset_anova_twoWay_comparisons.csv|dataset_anova_twoWay_interactions.csv}}  download {{:r:dataset_anova_twoWay_comparisons.csv|dataset_anova_twoWay_interactions.csv}} 
  
-<code>data <- read.csv("http://commres.net/wiki/_media/r/dataset_anova_twoway_comparisons.csv")+<code>stressdata <- read.csv("http://commres.net/wiki/_media/r/dataset_anova_twoway_comparisons.csv")
 > #display the data > #display the data
-data+stressdata
    Treatment   Age StressReduction    Treatment   Age StressReduction
 1     mental young              10 1     mental young              10
Line 253: Line 253:
 27   medical   old               0</code> 27   medical   old               0</code>
  
-<code>> aov(d$StressReduction~d$Treatment*d$Age, d) +<code> 
-Call: +stressdata <- read.csv("http://commres.net/wiki/_media/r/dataset_anova_twoway_comparisons.csv"
-   aov(formula = d$StressReduction ~ d$Treatment * d$Age, data = d+ 
- +> a.mod <- aov(StressReduction~Treatment*Age, data=stressdata)
-Terms: +
-                d$Treatment d$Age d$Treatment:d$Age Residuals +
-Sum of Squares           18   162                        18 +
-Deg. of Freedom                                      18 +
- +
-Residual standard error: 1 +
-Estimated effects may be unbalanced +
-> a.mod <- aov(d$StressReduction~d$Treatment*d$Age, d)+
 > summary(a.mod) > summary(a.mod)
-                  Df Sum Sq Mean Sq F value  Pr(>F)     +              Df Sum Sq Mean Sq F value  Pr(>F)     
-d$Treatment        2     18             9 0.00195 **  +Treatment      2     18             9 0.00195 **  
-d$Age              2    162      81      81   1e-09 *** +Age            2    162      81      81   1e-09 *** 
-d$Treatment:d$Age  4      0             0 1.00000     +Treatment:Age  4      0             0 1.00000     
-Residuals         18     18                          +Residuals     18     18                          
 --- ---
 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> 
  
-<code>> pairwise.t.test(d$StressReductiond$Treatment, p.adj = "none")+<code>> TukeyHSD(a.modwhich="Treatment") 
 +  Tukey multiple comparisons of means 
 +    95% family-wise confidence level
  
- Pairwise comparisons using t tests with pooled SD +Fit: aov(formula = StressReduction ~ Treatment * Age, data = stressdata)
  
-data:  d$StressReduction and d$Treatment +$Treatment 
 +                 diff        lwr       upr     p adj 
 +mental-medical      2  0.7968988 3.2031012 0.0013531 
 +physical-medical    1 -0.2031012 2.2031012 0.1135025 
 +physical-mental    -1 -2.2031012 0.2031012 0.1135025
  
-         medical mental + 
-mental   0.13    -      +</code>  
-physical 0.45    0.45  +<code> 
 +> TukeyHSD(a.mod, which="Age"
 +  Tukey multiple comparisons of means 
 +    95% family-wise confidence level
  
-P value adjustment methodnone</code>  +Fitaov(formula = StressReduction ~ Treatment * Age, data stressdata)
-<code>> pairwise.t.test(d$StressReduction, d$Age, p.adj "none")+
  
- Pairwise comparisons using t tests with pooled SD +$Age 
 +          diff       lwr       upr    p adj 
 +old-mid     -3 -4.203101 -1.796899 1.54e-05 
 +young-mid    3  1.796899  4.203101 1.54e-05 
 +young-old    6  4.796899  7.203101 0.00e+00 
 +
 +</code> 
  
-data:  d$StressReduction and d$Age  
- 
-      mid     old     
-old   2.5e-05 -       
-young 2.5e-05 2.3e-10 
- 
-P value adjustment method: none  
- 
-</code> 
  
 <WRAP info>위는 아래의 linear model 을 이용하여도 가능. 사실 모든 ANOVA 테스트는 linear model이기도 함(lm) <WRAP info>위는 아래의 linear model 을 이용하여도 가능. 사실 모든 ANOVA 테스트는 linear model이기도 함(lm)
Line 316: Line 314:
  
  
-</code> 
- 
-<code>> pairwise.t.test(d$StressReduction, d$Treatment, p.adj = "none") 
- 
- Pairwise comparisons using t tests with pooled SD  
- 
-data:  d$StressReduction and d$Treatment  
- 
-         medical mental 
-mental   0.13    -      
-physical 0.45    0.45   
- 
-P value adjustment method: none</code>  
-<code>> pairwise.t.test(d$StressReduction, d$Age, p.adj = "none") 
- 
- Pairwise comparisons using t tests with pooled SD  
- 
-data:  d$StressReduction and d$Age  
- 
-      mid     old     
-old   2.5e-05 -       
-young 2.5e-05 2.3e-10 
- 
-P value adjustment method: none  
- 
 </code> </code>
  
r/twoway_anova.1527033867.txt.gz · Last modified: 2018/05/23 09:04 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki