ucd-ipo / agroft

Agricultural Field Trial Statistics Package
http://ucd-ipo.github.io/agroft/
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

Inconsistent results in split plot designs #56

Closed moorepants closed 9 years ago

moorepants commented 9 years ago

From the console:

> library('agricolae')
> data('plots')
> spcrd.fit <- aov(yield ~ A + B + A:B + Error(A:block), plots)
> summary(spcrd.fit)

Error: A:block
          Df Sum Sq Mean Sq F value Pr(>F)
A          1 0.1071  0.1071   0.143   0.77
Residuals  1 0.7500  0.7500               

Error: Within
          Df Sum Sq Mean Sq F value   Pr(>F)    
A          1   4.20    4.20   1.172   0.3045    
B          2  29.78   14.89   4.155   0.0486 *  
A:B        2 300.44  150.22  41.922 1.37e-05 ***
Residuals 10  35.83    3.58                     

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> sprcbd.fit <- aov(yield ~ A + B + A:B + block + Error(A:block), plots)
> summary(sprcbd.fit)

Error: A:block
      Df Sum Sq Mean Sq
A      1 0.1071  0.1071
block  1 0.7500  0.7500

Error: Within
          Df Sum Sq Mean Sq F value   Pr(>F)    
A          1   4.20    4.20   1.172   0.3045    
B          2  29.78   14.89   4.155   0.0486 *  
A:B        2 300.44  150.22  41.922 1.37e-05 ***
Residuals 10  35.83    3.58                     

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

And results from the app for spcrd: agricultural field trial statistics package - mozilla firefox_109

And for sprcbd: agricultural field trial statistics package - mozilla firefox_110

Error: A:block
          Df Sum Sq Mean Sq F value Pr(>F)
A          1  0.222  0.2222   0.108  0.774
block      2  2.111  1.0556   0.514  0.661
Residuals  2  4.111  2.0556               

Error: Within
          Df Sum Sq Mean Sq F value   Pr(>F)    
B          2  29.78   14.89   3.458 0.082744 .  
A:B        2 300.44  150.22  34.890 0.000112 ***
Residuals  8  34.44    4.31                     

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
moorepants commented 9 years ago

The difference is due to the as.factor() calls.

See: http://r.789695.n4.nabble.com/ANOVA-define-as-factor-or-not-td3846861.html

I incorrectly assumed that the aov() call converted things on the rhs to factors and all else is the same.