Here we will demonstrate visually how power is calculated for a one-sided, one-sample T-test. We will assume that the data follow a normal distribution with standard deviation sigma for this demonstration.
We begin with the null and alternative hypotheses.
If the null hypothesis is true, the distribution of values looks like this.
If the alternative hypothesis is true, the distribution of values depends upon the true mean.
If a sample of size n is taken, the distribution of possible means from the sample can be constructed assuming either the null hypothesis is true, or assuming the mean is the non-null value.
The test statistic for this test is the T-statistic, which is based on the mean, and has a known distribution, which in turn permits the assignment of probabilities corresponding to its various values.
Under the null hypothesis, the t-statistic follows a central t distribution.
For this one-sided test, a specific cutoff t-value corresponds to the desired alpha level. Values of the t-statistic that are greater than this value result in p-values that are less than alpha. This cutoff t-value defines the rejection region. The probability of a Type 1 error, that is, rejection of the null hypothesis when it is true, is alpha. This cut-off t-value stays the same, regardless of the true value of the mean.
Under the alternative hypothesis, the t-statistic follows a non-central t distribution with a non-centrality parameter that is based on the difference of the true mean from the null mean, the standard deviation, and the sample size.
It is seen that the non-centrality parameter gets larger as the difference of the means is larger, the sample size gets larger, or the standard deviation gets smaller.
If we overlay a specific non-central t-distribution over the central t-distribution with its defined rejection region, we can see the probability of rejecting the null hypothesis when it is false, for a given mean, standard deviation, and sample size. This probability is the power of the test.
As the non-centrality parameter increases, the power increases.
Again, the non-centrality parameter gets larger as sample size gets larger, the standard deviation gets smaller, or the difference between the true mean and the null mean gets larger. Since researchers rarely have control over the true mean or the standard deviation, they can only increase or decrease the power by increasing or decreasing the sample size. Using the appropriate formulas, a corresponding sample size can be found for any desired power.