
Type I
The first possibility is the Type I sum of squares, which can be computed by first calculating the sum of squares for factor A, then the sum of squares of B conditional on A, and finally the sum of squares of the interaction (AB) after including the factors, A and B. This is why this is called the sequential sum of squares. Consequently, the order is as follows:

The main problem here is that these calculations depend on the order in which we specified the model. So, Y = A + B + A*B will be different from Y = B + A + A*B, which makes it very hard to justify (and hence to use in certain cases). Nevertheless, the interaction part is fine, since it is tested after we consider A and B. This is why Type I is generally used for testing the interaction, and not the main effects (when the design is unbalanced; if it was balanced, then we could test the main effects as well because SS(B) = SS(B|A)).