I agree with Şahin choice, G*Power software is effective tool to calculate sample size for many ranges of experiments. Also, you can determine effect size and power of the test, G*Power is free to download and easy to use after reading the manual, the download link:
I agree with both posts above and I would like to add two information. To me, at first it was unclear what the Numerator df parameter was, but this is a crucial point, since it depends on the data structure. If I take Ertugrul Sahins example with a 2x4 ANOVA, the main effect for the first factor would have 2-1=1 df, the second factor 4-1=3 df and the interaction (2-1)*(4-1)=3df. So, here you have to choose which effects are important for you, since the numerator df heavily influences the sample size.
Another crucial point is the effect size f. At first, I would not strictly stick to the 0.25, but to calculate the expected effect size, maybe from former studies. Everything else can not be more than a rule of thumb. Additionally, there is one cave! Lakens (2013) explained in is article "Calculating and reporting effect sizes..." that f^2 used in G*Power differs for example from that in SPSS!!
"The parameter Cohen’s f^2 used in G∗Power differs from the parameter for Cohen’s f^2 that is used in the statistical software package SPSS. Since η^2p = f^2/1 + f^2, this also means the values for η^2p are not interchangeable between SPSS and G∗Power. As Erdfelder(personal communication) explains, SPSSη^2p can be converted to G∗Power η^2p by first converting it to f^2..."
So, besides theoretical issues, you have to consider practical ones.
I have read the post and the comments. This is really helpful and informative for me as well. It looks that G*power software is the one which can solve the issue of calculating the sample size.
I would like to ask a question to know in more depth about the calculation. In your calculation, what do you mean by 2x4 ANOVA, is it 2-way ANOVA for 4 groups or something different?
Usually, in such kind of studies i have seen the researcher divide the number of participants into two groups ( for example control group and experiment group).
Two factors means, two different variables for which you group the data, e.g. a 2 X 4 ANOVA could be with the factors sex and and dose of a drug --> 2 (male vs female) X 4 (dose1 vs. dose 2 vs. dose3 vs. dose4), resulting in 8 indepndent groups. You could do this also with a repeated measurement on the second factor, e.g. you measure each participant after each dose. This would result in only 2 groups (male female) but combined with four treatments, a 2 X 4 ANOVA (a split plot design) with repeated measures on the second factor.
Thanks for your informative explanation on this point, I still have a further question based on this. According to your reply (to Rab), it seems like using "Fixed effects special, main effect and interactions" to estimate sample size is specifically for the design which should contain a between-variable at least. If this is true, how to deal with the case with all within-variables? especially for the interaction effect? For example, if I want to estimate the sample size based on a three-way interaction for a 3 within-variables design. Is it possible to realize in G power?