Power and Sample Size using Real Statistics

Real Statistics Functions: The Real Statistics Resource Pack supplies the following functions for calculating the power and sample size requirements for one-sample and two-sample hypothesis testing of the mean using the normal distribution.

NORM1_POWER(d, n, tails, α) = the power of a one sample normal test when d = Cohen’s effect size, n = the sample size, tails = # of tails: 1 or 2 (default) and α = alpha (default .05).

NORM1_SIZE(d, 1−β, tails, α) = the sample size required to detect an effect of size of d with power 1−β (default .80) when tails = # of tails: 1 or 2 (default) and α = alpha (default .05).

NORM2_POWER(m, s1, s2, n1, n2, tails, α) = the power of a two sample normal test when m = difference between population means, n1 and n2 are the sample sizes, s1 and s2 are the corresponding population standard deviations, tails = # of tails: 1 or 2 (default) and α = alpha (default .05).

NORM2_SIZE(ms1, s2, 1−β, tails, α, nratio) = the sample size required to detect a difference between population means of size of m with power 1−β (default .80) wheres1 and s2 are the two population standard deviations, nratio is as described below (default = 1), tails = # of tails: 1 or 2 (default) and α = alpha (default .05).

Note that if n2 is omitted or set to 0, then n2 is considered to be equal to n1.

For NORM2_SIZE only the size of the first sample is returned. If the two samples don’t have the same size, you can specify the size of the second sample in terms of the size of the first sample using the nratio argument. E.g. if the size of the second sample is half of the first, then set nratio = .5.

If you set nratio to be a negative number then the absolute value of this number will be used as the sample size of the second sample. E.g. if nratio = -50, then the NORM2_SIZE function will find the size of the first sample assuming that the second sample has 50 elements.

Referring to Example 2 of Statistical Power and Sample Size, we see that NORM1_POWER(.2, 110, 1, .05) = .6746 and NORM1_SIZE(.2, .80, 1, .05) = 154.56, as expected.

8 thoughts on “Power and Sample Size using Real Statistics”

  1. Dear Charles,

    Thank you for your great package!
    I am wondering in case of non parametric tests, how can I perform a power analysis to estimate the minimal required number of subjects in my samples ?
    Thank you for your great work and for your answer,

    Best regards,

    Reply
  2. Dear Charles: Thank you for a wonderful package! Unfortunately some of us need more help in understanding some procedures. I would like to ask you if one can calculate sample size for an in-vitro test with a given Specificity, a given Sensitivity and a prevalence of the disease in the population to be screened with the test. Thank you very much and regards, Ricardo

    Reply
  3. Dear Dr. Charles,

    I have two simple questions for you:
    1) Why the two functions NORM1_SIZE and T1_SIZE return different values with the same input parameters? I was expecting they to give the same result.

    2) As from previous question there should be some difference between the two functions that I don’t understand, which is the most appropriate one to determine the desired sample size for a paired t-test?

    Thank you very much
    Best Regards
    Piero

    Reply
    • Piero,
      1. They are different since the normal distribution is different from the t distribution. Also the two tests are different.
      2. For the paired t test you should use T1_SIZE.
      Charles

      Reply

Leave a Comment