SPLIT PLOT ANALYSIS

df <- read.csv("splt.txt", header = TRUE)
y <- unlist(df[paste("y", 1:4, sep = "")])
coat <- factor(unlist(df[paste("a", 1:4, sep = "")]), labels = paste("C", 1:4))
temp <- factor(rep(df$Temp, 4), labels = c(360, 370, 380))
plot <- factor(rep(df$plot, 4), labels = paste("Plot", 1:6))
boxplot(split(y, coat))

plot of chunk unnamed-chunk-1

boxplot(split(y, temp))

plot of chunk unnamed-chunk-1

boxplot(split(y, plot))

plot of chunk unnamed-chunk-1

twoway.boxplot(y, coat, temp)

plot of chunk unnamed-chunk-1

library(lme4)
anova(lmer(y ~ temp * coat + (1 | plot)))
## Analysis of Variance Table
##           Df Sum Sq Mean Sq F value
## temp       2    682     341    2.74
## coat       3   4289    1430   11.48
## temp:coat  6   3270     545    4.38
summary(aov(y ~ temp * coat + Error(plot)))
## 
## Error: plot
##           Df Sum Sq Mean Sq F value Pr(>F)
## temp       2  26519   13260    2.75   0.21
## Residuals  3  14440    4813               
## 
## Error: Within
##           Df Sum Sq Mean Sq F value Pr(>F)   
## coat       3   4289    1430   11.48  0.002 **
## temp:coat  6   3270     545    4.38  0.024 * 
## Residuals  9   1121     125                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(lm(y ~ plot + coat))
## Analysis of Variance Table
## 
## Response: y
##           Df Sum Sq Mean Sq F value  Pr(>F)    
## plot       5  40959    8192   27.99 4.2e-07 ***
## coat       3   4289    1430    4.88   0.015 *  
## Residuals 15   4391     293                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(lm(y ~ temp * coat))
## Analysis of Variance Table
## 
## Response: y
##           Df Sum Sq Mean Sq F value Pr(>F)   
## temp       2  26519   13260   10.23 0.0026 **
## coat       3   4289    1430    1.10 0.3860   
## temp:coat  6   3270     545    0.42 0.8518   
## Residuals 12  15561    1297                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1