Plan <- read.table("https://husson.github.io/livre_exo/chap13_ex1.csv", header = TRUE, sep=";",row.names=1, encoding = "latin1") for (i in 1:3) Plan[,i] <- as.factor(Plan[,i]) X <- model.matrix(~ A+B+C+A:B+A:C+B:C, Plan, contrasts = "contr.sum") t(X)%*%X