Experimental data in blocks, factor A in plots and factor B in sub-plots.
data(plots)
A data.frame
with 18 observations on the following 5 variables.
@details
block block
plot a factor with levels p1, p2, p3, p4, p5, and p6
A a factor with levels a1, and a2
B a factor with levels b1, b2, and b3
yield yield
International Potato Center. CIP
#> 'data.frame': 18 obs. of 5 variables: #> $ block: int 1 1 1 1 1 1 2 2 2 2 ... #> $ plot : Factor w/ 6 levels "p1","p2","p3",..: 1 1 1 2 2 2 3 3 3 4 ... #> $ A : Factor w/ 2 levels "a1","a2": 1 1 1 2 2 2 1 1 1 2 ... #> $ B : Factor w/ 3 levels "b1","b2","b3": 1 2 3 1 2 3 1 2 3 1 ... #> $ yield: int 4 1 9 6 10 2 5 3 10 4 ...plots[,1] <-as.factor(plots[,1]) # split-plot analysis model <- aov(yield ~ block + A + Error(plot)+ B + A:B, data=plots) summary(model)#> #> Error: plot #> Df Sum Sq Mean Sq F value Pr(>F) #> block 2 2.111 1.0556 0.514 0.661 #> A 1 0.222 0.2222 0.108 0.774 #> 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 ‘ ’ 1b<-nlevels(plots$B) a<-nlevels(plots$A) r<-nlevels(plots$block) dfa <- df.residual(model$plot) Ea <-deviance(model$plot)/dfa dfb <- df.residual(model$Within) Eb <-deviance(model$Within)/dfb Eab <- (Ea +(b-1)*Eb)/(b*r) # Satterthwaite dfab<-(Ea +(b-1)*Eb)^2/(Ea^2/dfa +((b-1)*Eb)^2/dfb) # Comparison A, A(b1), A(b2), A(b3) comparison1 <-with(plots,LSD.test(yield,A,dfa,Ea)) comparison2 <-with(plots,LSD.test(yield[B=="b1"],A[B=="b1"],dfab,Eab)) comparison3 <-with(plots,LSD.test(yield[B=="b2"],A[B=="b2"],dfab,Eab)) comparison4 <-with(plots,LSD.test(yield[B=="b3"],A[B=="b3"],dfab,Eab)) # Comparison B, B(a1), B(a2) comparison5 <-with(plots,LSD.test(yield,B,dfb,Eb)) comparison6 <-with(plots,LSD.test(yield[A=="a1"],B[A=="a1"],dfb,Eb)) comparison7 <-with(plots,LSD.test(yield[A=="a2"],B[A=="a2"],dfb,Eb))