I need to write my own function in R for One-Way ANOVA with different sample sizes. On wiki is a nice example of how to calculate the F-ratio if the sample sizes are equal:
I already read multiple times that there is basically no difference in the way of calculation, however, I have a couple of questions (referring to the example in wikipedia):
Step 2: Calculate the overall mean:
With different sample sizes, do I still take the mean of the means or the mean of all observations from all groups together?
Step 3: I have to replace $n$ by $n_1, n_2,...$ where $n_i$ ist the number of observations in the i-th group, right?
Thanks in advance!