# 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) } ) table11.5.lm <- lm(y ~ block +a +b +c +a:b +a:c +b:c +a:b:c, data = table11.5) anova(table11.5.lm) # check model assumptions par(mfrow=c(2,2)) plot(table11.5.lm) par(mfrow=c(1,1))