# This R code analyzes the data from a split-plot experiment from Ott and Longnecker's # 'An Introduction to Statistical Methods and Data Analysis' 6th edition. # This is Example 18.1 on page 1098 of the text. # This design has a randomized complete block whole plot structure, with # 3 blocks and 3 varieties of soybeans randomized within each block. # Each block had 3 plots for the soybeans, then each plot had 4 subplots, # and one of 4 phosphorous levels was randomized to eacn subplot within each plot # The nlme package must be installed and loaded to use the lme function. library(nlme) data <- matrix(scan(),ncol=4,byrow=TRUE) 1 1 0 53.5 1 1 30 60.6 1 1 60 60.8 1 1 120 59.6 1 2 0 44.8 1 2 30 51.0 1 2 60 51.5 1 2 120 49.9 1 3 0 50.7 1 3 30 54.9 1 3 60 59.4 1 3 120 64.7 2 1 0 62.2 2 1 30 68.8 2 1 60 70.9 2 1 120 67.8 2 2 0 52.5 2 2 30 58.7 2 2 60 59.4 2 2 120 58.1 2 3 0 61.4 2 3 30 64.9 2 3 60 70.0 2 3 120 74.4 3 1 0 53.4 3 1 30 59.5 3 1 60 61.0 3 1 120 60.3 3 2 0 43.1 3 2 30 49.6 3 2 60 49.7 3 2 120 49.5 3 3 0 50.6 3 3 30 54.8 3 3 60 60.5 3 3 120 65.0 data OttEx181 <- data.frame(data) colnames(OttEx181) <- c("block","variety","phos","yield") OttEx181$block <- as.factor(OttEx181$block) OttEx181$variety <- as.factor(OttEx181$variety) OttEx181$phos <- as.factor(OttEx181$phos) rm(data) Ott181SplitPlt1 <- lme( yield ~ variety*phos, data = OttEx181, random = ~ 1 | block/variety ) > summary(Ott181SplitPlt1) Linear mixed-effects model fit by REML Data: OttEx181 AIC BIC logLik 98.17487 115.8457 -34.08743 Random effects: Formula: ~1 | block (Intercept) StdDev: 5.277806 Formula: ~1 | variety %in% block (Intercept) Residual StdDev: 0.5946032 0.4759007 Fixed effects: yield ~ variety * phos Value Std.Error DF t-value p-value (Intercept) 56.36667 3.0787051 18 18.308563 0.0000 variety2 -9.56667 0.6218438 4 -15.384357 0.0001 variety3 -2.13333 0.6218438 4 -3.430658 0.0265 phos30 6.60000 0.3885713 18 16.985299 0.0000 phos60 7.86667 0.3885713 18 20.245103 0.0000 phos120 6.20000 0.3885713 18 15.955886 0.0000 variety2:phos30 -0.30000 0.5495228 18 -0.545928 0.5918 variety3:phos30 -2.63333 0.5495228 18 -4.792036 0.0001 variety2:phos60 -1.13333 0.5495228 18 -2.062395 0.0539 variety3:phos60 1.20000 0.5495228 18 2.183713 0.0425 variety2:phos120 -0.50000 0.5495228 18 -0.909880 0.3749 variety3:phos120 7.60000 0.5495228 18 13.830180 0.0000 Correlation: (Intr) varty2 varty3 phos30 phos60 phs120 vr2:30 vr3:30 vr2:60 vr3:60 v2:120 variety2 -0.101 variety3 -0.101 0.500 phos30 -0.063 0.312 0.312 phos60 -0.063 0.312 0.312 0.500 phos120 -0.063 0.312 0.312 0.500 0.500 variety2:phos30 0.045 -0.442 -0.221 -0.707 -0.354 -0.354 variety3:phos30 0.045 -0.221 -0.442 -0.707 -0.354 -0.354 0.500 variety2:phos60 0.045 -0.442 -0.221 -0.354 -0.707 -0.354 0.500 0.250 variety3:phos60 0.045 -0.221 -0.442 -0.354 -0.707 -0.354 0.250 0.500 0.500 variety2:phos120 0.045 -0.442 -0.221 -0.354 -0.354 -0.707 0.500 0.250 0.500 0.250 variety3:phos120 0.045 -0.221 -0.442 -0.354 -0.354 -0.707 0.250 0.500 0.250 0.500 0.500 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.43673224 -0.46401040 -0.07996361 0.37411371 1.57510029 Number of Observations: 36 Number of Groups: block variety %in% block 3 9 > anova(Ott181SplitPlt1) numDF denDF F-value p-value (Intercept) 1 18 360.3594 <.0001 variety 2 4 232.6000 1e-04 phos 3 18 601.0379 <.0001 variety:phos 6 18 86.4043 <.0001