# this example illustrates partial confounding with blocks ; data <- scan(what = list(block=0,replicate=0,a=0,b=0,c=0,y=0), multi.line=F) 1 1 0 0 0 25 1 1 0 1 1 34 1 1 1 1 1 42 1 1 1 0 0 25 2 1 1 1 0 43 2 1 0 0 1 30 2 1 1 0 1 40 2 1 0 1 0 33 3 2 1 1 1 39 3 2 0 1 0 29 3 2 0 0 0 27 3 2 1 0 1 40 4 2 0 1 1 38 4 2 1 0 0 37 4 2 1 1 0 46 4 2 0 0 1 34 5 3 0 0 0 26 5 3 0 0 1 32 5 3 1 1 0 52 5 3 1 1 1 51 6 3 1 0 0 43 6 3 0 1 0 34 6 3 1 0 1 40 6 3 0 1 1 36 data table11.5 <- data.frame(data) # using the within function to convert variables to factor table11.5 <- within(table11.5, { block <- factor(block) replicate <- factor(replicate) a <- factor(a) b <- factor(b) c <- factor(c) } ) summary(aov(y ~ replicate +block %in% replicate +a +b +c +a:b +a:c +b:c +a:b:c, data = table11.5)) # it is easier to see the results using the afex package library(afex) table11.5.afex1 <- mixed(y ~ replicate + (1|block:replicate) +a*b*c, data = table11.5) summary(table11.5.afex1) nice(table11.5.afex1) lsmeans(table11.5.afex1, ~ a) lsmeans(table11.5.afex1, ~ b)