I have 400 groups of data (different locations). Each group have between 5 and 200 samples. Each sample have only one categorical variable that can take a value among 4 possible ( 'a', 'b', 'c', 'd' ). I'd like to compare the distributions of the different groups. To do so, I need to discard the groups with very few sample (statistically insignificant). I'd like to find the minimum group size in this case, in a mathematical way (without running empirical tests).
You can retain the groups that have a small sample size. This is no problem. The modeling technique you want is called multilevel modeling. You can model the variance between the groups, and get an estimate for the different categorical variables. Groups with small sample sizes will not contribute as much to the estimation as will groups with large sample size. There is no need to discard small groups unless they are irrelevant to your results.