MJ241 {mj} | R Documentation |
MJ241 data frame with 16 observations on 4 variables.
[,1] | block | factor | block identifier |
[,2] | fert | factor | fertilizer level |
[,3] | variety | factor | variety level |
[,4] | yield | numeric | plot yield |
# attach library; get data #library( pda ) data( MJ241 ) # MJ 24.1 Split Plot MJ241$plot <- 4 * ( MJ241$block - 1 ) + MJ241$fert MJ241$fert <- factor( MJ241$fert ) MJ241$block <- factor( MJ241$block ) MJ241$variety <- factor( MJ241$variety ) MJ241$plot <- factor( MJ241$plot ) # split plot with block and block:fert as fixed effects MJ241.fit <- aov( yield ~ block * fert + variety + variety:fert, MJ241 ) # split plot using block:fert as random effect # see Venables & Ripley (1994, sec. 6.7) or # Chambers & Hastie (1992, sec. 5.2.1) MJ241.bfit <- aov( yield ~ fert + variety + variety:fert + Error( block + block:fert ), MJ241 ) print( summary( MJ241.bfit )) # split plot using LME (Splus on ALPHA computers only) # see Lindstrom & Bates (1988) JASA 83:1014-1022 library( nlme ) MJ241.lme <- lme( yield ~ fert + variety + variety:fert, random = ~ block + block:fert, cluster = ~ plot, data = MJ241, est.method = "RML", re.structure = "identity") print( summary( MJ241.lme )) print( fitted.values( MJ241.lme ))