rstatisticsmixed-modelslinearmodels

Linear mixed models with missing cells


I am helping another researcher with their coding in R. I did not work with them during the planning of the experiment design and now I could really use some help with this tricky design. I have four fixed factor: FactorA, FactorB, FactorC, and FactorD. The experiment is not a fully factorial design. There are missing cells (combinantions of factors that are not available) in addition to umbalaced number of samples. For the combinations FactorA:FactorB, FactorA:FactorC, and FactorB:FactorC, I have the proper amount of cells (treatment combinations). I also have a random factor: Block, which is nested within FactorD. In my field, it is common for people (even in high impact journals) just to run different ANOVAs for each factor to avoid dealing with this type of problem, but I wonder if I could write a model that comprises all those factors.

Please, could I use something like this?

lmerTest::lmer(Response ~ FactorA + FactorB + FactorC + FactorD +
                        FactorA:FactorB + FactorA:FactorC + FactorB:FactorC +
                        (1|FactorD/Block),indexes)

I appreciate any suggestions you may have!


Solution

  • Assuming that what you're missing from the design are some combinations of factor D with the other factors, this is close.

    You can express this a little more compactly as

    Response ~ (FactorA + FactorB + FactorC)^2 + FactorD + (1|FactorD:Block)
    

    You shouldn't use (1|FactorD/Block), because that will expand to (1|FactorD) + (1|FactorD:Block) and give you a redundant term (FactorD will be specified as both a fixed and a random effect)

    Unbalanced numbers of observations don't matter as long as a factor combination is not completely missing/has at least one observation.