What a sample size calculation answers
A power calculation states how many subjects are needed to detect an effect of a given size, with a stated false-positive rate and a stated chance of success. Alpha is the probability of claiming an effect that is not there (a type I error); power, 1 − β, is the probability of finding one that is. A study with 80 % power misses one true effect in five, so 80 % is a floor rather than a target to be proud of.
The calculation needs an effect size, and the effect size must come from outside it: a pilot experiment, a published estimate or the smallest difference that would change a decision. Using the effect you hope for rather than the effect you expect is the most common way sample sizes become fiction.
t-tests: the exact noncentral-t calculation
For a two-sample t-test the standardised effect is Cohen’s d, the difference between the means divided by their common standard deviation. Under the alternative hypothesis the test statistic follows a noncentral t distribution with df = 2n − 2 and noncentrality d·√(n/2) for n per group. Power is the probability that this statistic falls beyond the critical value: 1 − F(tcrit; df, ncp) + F(−tcrit; df, ncp) for a two-sided test.
For a paired or one-sample test, d is the mean difference divided by the SD of the differences, df = n − 1 and the noncentrality is d·√n; n is then the total number of pairs, not the number per group. The tool finds the smallest integer n whose exact power reaches the target, and shows the power at nearby n so you can see how steep the curve is.
Two proportions and the assumptions
For two independent proportions the usual planning formula uses the normal approximation: n = (z₁₋α/₂·√(2·p̄·(1−p̄)) + z_power·√(p₁(1−p₁) + p₂(1−p₂)))² ÷ (p₁ − p₂)², where p̄ is the average of the two proportions, rounded up. It is a good approximation when the expected counts are large and the proportions are not near 0 or 1; with small counts or rare events, plan from an exact test instead, which generally needs more subjects.
All three modes assume independent observations, equal group sizes and a correct model. They do not account for dropout, clustering, multiple comparisons or non-compliance: inflate the answer for expected loss to follow-up, and correct alpha when you test several endpoints. This is a planning aid only; it assumes equal group sizes, normal data and equal variances.