# Unfold degrees of freedom of interaction in factorial design analysis in R

I've been trying to analyse data from a factorial design with missing cells without much success until now. I'm using Anova from car package, that, according with I've read, can handle unbalanced data with type III sum of squares. But when I detect an interaction effect I don't know how to unfold the degree of freedom of the interaction and discover what is the best combination of factors. I think I have to do something like in this article

da Rocha, F et al. An approach to the decomposition of interaction in a factorial experiment with five factors, Acta Sci., Agron. 34(1), 2012.

Some one know's how to unfold the degrees of freedom?

Here follows a reproducible example

fdata <- read.table("http://labpib.ffclrp.usp.br/~rsilva/fdata.txt")
library(car)
options(contrasts=c("contr.sum","contr.poly"))
fdata.hi <- aov(log(resp+1) ~ PIE*NS*La*Li*Lf, data=fdata)
# trying to analyse as a full factorial design
Anova(fdata.hi, type="III", singular.ok=TRUE)
# trying to analyse as an one-way anova
library(agricolae)
model1 <- aov(log(resp+1) ~ ALL, fdata)
HSD.test(model1, "ALL")

x11(); par(mfrow=c(3,2))
apply(combn(2:6,2)[,1:6], 2,
function(x) interaction.plot(fdata[,x[1]], fdata[,x[2]], fdata$resp)) x11(); par(mfrow=c(2,2)) apply(combn(2:6,2)[,7:10], 2, function(x) interaction.plot(fdata[,x[1]], fdata[,x[2]], fdata$resp))
par(mfrow=c(1,1))


That is what I'm doing until now, try to verify graphically what is the best factor combination, knowing that I have a significant interaction among four factors.

-
If you have missing cells you cannot use ANOVA. Unbalanced just means that the groups have a different size. Are there really cells that are empty? –  Henrik Oct 9 '12 at 10:05
According with I've have read users.monash.edu.au/~murray/BDAR, yes I can. Generally the books divide unbalance in different number of replicates, and missing cells, in my case, some combination of factors are missing. The book above suggest that I treat the problem as an one-way anova and design contrast to test each main effect and interaction, but I'm confused on how to generate this contrasts, an even if I do, how to test the best combination of factors, do I have to fix every factor and make all other vary and test the means. I'm using interaction plots, and tukey test. –  user1265067 Oct 9 '12 at 12:29
I think you could create the model.matrix and then delete all empty contrasts. But if you want more precise instruction a reproducible example is needed. –  Henrik Oct 9 '12 at 12:33
Hi Henrik, thanks for the tip, I always forget the reproducible example, and many times I don't have an answer because of that. I have edited above, and used my data to show what I'm doing... –  user1265067 Oct 9 '12 at 18:38