I want to perform a two-way ANOVA in a data frame that lacks one observation.

I have values for each (month,year) pair, and I am performing a two-way ANOVA to check if moving seasonality exists.

There is one value missing for a given (month,year).

My question is theoretical: whether the two-way anova test can still be performed. All formulas I find is for a full matrix.


enter image description here

(taken from here)

Consider also the case when the table from the same page had a NA instead of that observation:

data frame table

For instance, the total formula no longer makes sense: $SST=\sum_{i=1}^a\sum_{j=1}^n(y_{ij}-\bar{y})^2$, where $a$ is the number of rows and $n$ is the number of columns. It does not work because there are "holes" in the matrix.

Is there any reference that discusses my case? I guess I can tweak the formulas, and R seems to work fine with NAs, but I would like to know how such things affects the degrees of freedom for example ...


Yes you can still do the ANOVA however you need to use SSI over SSIII. I have provided a PDF that will explain in more detail the DF and the difference between SS I and SS III. These notes are from an experimental design course I took which the professor, John Borkowski wrote. Notes

Which the notes refer to SAS code. So using the anova function with R it defaults to type III SS. So to get type I you have to use the car package.

  • $\begingroup$ For future reference, since the dropbox link may go offline at any time, the notes in the link use the following book as reference, which (as far as I had the time to see) is very good: The Analysis of Messy Data: Volume I, by Milliken and Johnson. $\endgroup$ – Ricardo Cruz Aug 1 '15 at 9:52
  • $\begingroup$ ok sounds good. $\endgroup$ – Lauren Goodwin Aug 4 '15 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.