Sample size Calculator

Student's t-test

  • Statistical hypothesis used to determine if two sets of data are significantly different from each other by compare the means.

  • Is commonly applied when the test statistic would follow a normal distribution.

  • Can involve independent samples or paired samples.

Power and Sample size

  • The power of a statistical test is the probability that it correctly rejects the null hypothesis (H0) when it is false.

  • Power analysis can be used to calculate the minimum sample size required to detect an given effect.

  • In t-test, the effect to detect is the difference between two population means.

Example of power

The power of t-test by comparing two samples of size 20 for group, with a difference of means of 4 and a standard desviation of 5 is about 0.7:

power.t.test(n=20, delta=4, sd=5)

     Two-sample t test power calculation 

              n = 20
          delta = 4
             sd = 5
      sig.level = 0.05
          power = 0.6933994
    alternative = two.sided

NOTE: n is number in *each* group

Sample size calculator

An important question is the inverse:

If we have an estimation of means and stardard desviation of the two populations, what is the minimum sample size required for a specific power?

This is what my application calculates:

Example of sample size

What is the required sample size for a power of 0.9 to test two groups with a effect size of 4 and a standard desviation of 5?

power.t.test(power=0.8, delta=4, sd=5)

     Two-sample t test power calculation 

              n = 25.52463
          delta = 4
             sd = 5
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group