# F-test to determine whether more than two sets of data differ

Here is the context for my question:

I understand that you can fit the same model to two different datasets separately and then fit the model to the datasets pooled together as a way to discern whether the datasets are different enough to warrant modeling separately. This being done using an F-test where:

SSsep = SSa + SSb, dfsep = dfa + dfb

and

F = (SSpool - SS ssep)/(dfpool-dfsep)/ (SSsep/dfsep)

My question is two-fold.

1. Is it appropriate to extend this approach to more than two datasets? For example, is there any reason not to use this approach to compare three datasets? Such that...

SSsep = SSa + SSb + SSc, dfsep = dfa + dfb + dfc

Tinkering around with simulated data it appears that doing this would allow you to detect a difference between any two of the three datasets, though it wouldn't allow you to tell which datasets are different.

2. If the above is a valid approach, is there a difference between (1) conducting the comparison between all three data sets at the same time (ABC vs A, B, C) and then only doing the pairwise comparisons between datasets if a difference is detected (AB vs A & B...BC vs B & C...AC vs A & C) and (2) just starting with the pairwise comparisons? If so, what is the difference between these two approaches? I'm not sure how to articulate it, but I sense that there is a difference between these two approaches.

Thanks so much,

Angela

Just to visualize the question, here is a hypothetical example where two of the data sets (the blue and gray) are sufficiently similar to be modeled by the same model and one of the data sets (the green) should probably be modeled separately. The black line is the model fit to the pooled data.