# Wheat -------------------------------------------------------------------
library (car)
yield <- c(32.3, 33.3, 30.8, 34, 33, 34.3, 26, 34.3, 36.3, 35.3, 29.8, 35, 36.8, 32.3, 28, 36.5, 34.5, 35.8, 28.8)
block <- as.factor(c (1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5))
lin <- as.factor(c (1,2,3,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4))
wheat <- data.frame(yield, block, lin)
fw <- yield ~ lin
fligner.test(fw, wheat)
##
## Fligner-Killeen test of homogeneity of variances
##
## data: yield by lin
## Fligner-Killeen:med chi-squared = 0.58447, df = 3, p-value = 0.9
anova ( lm (fw, wheat))
## Analysis of Variance Table
##
## Response: yield
## Df Sum Sq Mean Sq F value Pr(>F)
## lin 3 122.463 40.821 13.121 0.0001803 ***
## Residuals 15 46.666 3.111
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova ( aov ( lm (fw, wheat)), type=3)
## Anova Table (Type III tests)
##
## Response: yield
## Sum Sq Df F value Pr(>F)
## (Intercept) 5923.7 1 1904.068 < 2.2e-16 ***
## lin 122.5 3 13.121 0.0001803 ***
## Residuals 46.7 15
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pw <- power.anova.test(groups = 4, n = c(5,5,5,4), between.var = 40.8, within.var = 3.1, power = NULL)
1-pw$power
## [1] 0.00000e+00 0.00000e+00 0.00000e+00 4.32987e-15
TukeyHSD(aov (lm (fw, wheat)))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = lm(fw, wheat))
##
## $lin
## diff lwr upr p adj
## 2-1 0.36 -2.855148 3.575148 0.9879117
## 3-1 -0.72 -3.935148 2.495148 0.9155076
## 4-1 -6.27 -9.680180 -2.859820 0.0004636
## 3-2 -1.08 -4.295148 2.135148 0.7691443
## 4-2 -6.63 -10.040180 -3.219820 0.0002638
## 4-3 -5.55 -8.960180 -2.139820 0.0014757