Section 11.25

Statistical power

Definition

Statistical power is the probability that a hypothesis test §11.22 rejects its null hypothesis, the model of no effect, when a specified alternative is true: the probability that the test detects an effect of a given size. Its complement is β\beta (beta), the probability of a Type II error §1.22, a missed effect; power is 1−β1 - \beta. Power depends on four things: the significance level α\alpha (alpha), which is the false-alarm probability the test allows, the size of the true effect, the variability of the measurements, and the number of independent units.

The idea

A change truly makes a request 2 milliseconds (ms) faster, but the times of single requests have a standard deviation §11.14 of 10 ms: a single time typically lies about 10 ms from the mean. With 25 independent requests per version, the two averages are still noisy enough to hide the 2 ms most of the time: a two-sided test at α=0.05\alpha = 0.05 rejects in only about 11% of such experiments. The experimenter will most likely report “no significant difference” about a real improvement. Power is the number that warns of this before the experiment is run.

The intuition is signal against noise. The signal is the effect, here 2 ms. The noise is the standard error §11.15 of the estimated difference: how much the difference of the two averages varies from one experiment to the next. The test rejects when the observed difference lies more than about two standard errors from zero. If the true effect is less than one standard error, the observed difference rarely gets that far; if the true effect is three standard errors, it gets that far in about 85% of experiments. Every way of raising power either enlarges the signal or shrinks the noise.

How it works

For the common case of comparing the means of two groups, the parts are:

  1. The difference of the two group means has standard error SE=σ2/n\mathrm{SE} = \sigma\sqrt{2/n}. Each mean has variance σ2/n\sigma^2/n, where the variance is the square of the standard deviation, and the variances of two independent means add: 2σ2/n2\sigma^2/n.

  2. The test rejects when the observed difference is more than zz standard errors from zero, where z=1.96z = 1.96 for a two-sided test at α=0.05\alpha = 0.05. The value 1.96 is the point beyond which a normal (bell-shaped) distribution with mean 0 and standard deviation 1 has 2.5% of its probability, so the two tails together hold 5%.

  3. By the central limit theorem §15.45, averages of many independent values are approximately normally distributed. The observed difference is therefore approximately normal, centered at δ\delta, with standard deviation SE. Measured in standard errors, it is centered at δ/SE\delta/\mathrm{SE} with standard deviation 1.

  4. Power is the probability that this value lands beyond +1.96+1.96 or below −1.96-1.96.

Three levers follow.

A smaller α\alpha moves the threshold outward and lowers power. A one-sided test puts all of α\alpha into one tail, with threshold 1.645 instead of 1.96 at α=0.05\alpha = 0.05; it has more power in its chosen direction and none in the other.

Only independent units count in nn. Ten thousand requests measured in three sessions, each session fast or slow as a whole, carry information about three sessions. The standard error, and with it the power, is governed by the number of sessions; the Pseudoreplication §11.6 entry shows the calculation.

A power analysis is usually turned around to plan an experiment: fix α\alpha, the smallest effect worth detecting, an estimate of σ\sigma from earlier data and the power wanted, often 0.8, and solve for nn. For designs without a formula, simulate: generate many artificial data sets with the assumed effect and noise, run the test on each, and count the fraction that reject.

Worked example

Two versions are compared with independent measurements in each group. The single-measurement standard deviation is σ=10\sigma = 10 ms in both groups, the true effect is δ=2\delta = 2 ms, and the test is two-sided at α=0.05\alpha = 0.05. Below, Φ(x)\Phi(x) is the probability that a normal value with mean 0 and standard deviation 1 is at most xx.

25 units per group. Each mean has variance 102/25=100/25=4 ms210^2/25 = 100/25 = 4 \text{ ms}^2. The difference has variance 4+4=8 ms24 + 4 = 8 \text{ ms}^2 and standard error 8≈2.828\sqrt{8} \approx 2.828 ms. The effect is 2/2.828≈0.7072/2.828 \approx 0.707 standard errors. The observed difference exceeds +1.96+1.96 standard errors with probability Φ(0.707−1.960)=Φ(−1.253)≈0.105\Phi(0.707 - 1.960) = \Phi(-1.253) \approx 0.105, and falls below −1.96-1.96 with probability Φ(−0.707−1.960)=Φ(−2.667)≈0.004\Phi(-0.707 - 1.960) = \Phi(-2.667) \approx 0.004. Power ≈0.105+0.004=0.109\approx 0.105 + 0.004 = 0.109, about 11%.

400 units per group. Each mean has variance 100/400=0.25 ms2100/400 = 0.25 \text{ ms}^2, the difference 0.25+0.25=0.5 ms20.25 + 0.25 = 0.5 \text{ ms}^2, and the standard error is 0.5≈0.707\sqrt{0.5} \approx 0.707 ms. The effect is now 2/0.707≈2.8282/0.707 \approx 2.828 standard errors, and the power is Φ(2.828−1.960)+Φ(−2.828−1.960)=Φ(0.868)+Φ(−4.788)≈0.807+0.000=0.807\Phi(2.828 - 1.960) + \Phi(-2.828 - 1.960) = \Phi(0.868) + \Phi(-4.788) \approx 0.807 + 0.000 = 0.807, about 81%. Sixteen times as many units made the standard error four times smaller and raised the power from 11% to 81%.

Units needed for power 0.8. Ignoring the negligible far tail, power 0.8 needs δ/SE=1.960+0.842=2.802\delta/\mathrm{SE} = 1.960 + 0.842 = 2.802, where 0.842 is the point that a standard normal value stays below with probability 0.8. With SE=σ2/n\mathrm{SE} = \sigma\sqrt{2/n} this gives n=2σ2×2.8022/δ2=2×100×7.851/4≈392.6n = 2\sigma^2 \times 2.802^2/\delta^2 = 2 \times 100 \times 7.851/4 \approx 392.6, so 393 units per group.

An exact case. A coin is tossed four times, and the test rejects the null hypothesis “heads has probability 0.5” only if all four tosses are heads. Under the null hypothesis that happens with probability 0.54=0.06250.5^4 = 0.0625, the Type I error probability. If the true probability of heads is 0.75, the test rejects with probability 0.754=0.56252=0.316406250.75^4 = 0.5625^2 = 0.31640625, about 32%: this is the power against that alternative, and the Type II error probability is 1−0.31640625=0.683593751 - 0.31640625 = 0.68359375. The rule did not change; only the true state of the coin did.

Stated precisely

Let RR be the rejection region of a test with statistic TT, and let QQ be a distribution in the alternative hypothesis. The power against QQ is power(Q)=PrQ(T∈R)=1−β(Q),\mathrm{power}(Q) = \Pr_Q(T \in R) = 1 - \beta(Q), where PrQ\Pr_Q is probability computed as if QQ generated the data and β(Q)\beta(Q) is the Type II error probability. Power is a function of the alternative, not one number for the test.

Take two groups of nn independent measurements with a common, known standard deviation σ\sigma, a true difference of means δ\delta, and a two-sided z-test at level α\alpha, a test that compares the difference, measured in standard errors, with the normal distribution. Then power=Φ(δSE−z1−α/2)+Φ(−δSE−z1−α/2),SE=σ2/n,\mathrm{power} = \Phi\!\left(\frac{\delta}{\mathrm{SE}} - z_{1-\alpha/2}\right) + \Phi\!\left(-\frac{\delta}{\mathrm{SE}} - z_{1-\alpha/2}\right), \qquad \mathrm{SE} = \sigma\sqrt{2/n}, where Φ\Phi is the cumulative distribution function of the standard normal distribution and zqz_q is the value with Φ(zq)=q\Phi(z_q) = q, so z1−α/2=1.96z_{1-\alpha/2} = 1.96 for α=0.05\alpha = 0.05. The number of units per group needed for power 1−β1 - \beta is approximately n=2σ2(z1−α/2+z1−β)2δ2.n = \frac{2\sigma^2\,(z_{1-\alpha/2} + z_{1-\beta})^2}{\delta^2}.

These formulas rest on three assumptions.

  1. Independent measurements within and between groups.

  2. A known σ\sigma, or enough units that its estimate is accurate. With an estimated σ\sigma and few units, the t-distribution replaces the normal distribution and the power is slightly lower.

  3. A normal difference of means: exact for normally distributed measurements, approximate by the central limit theorem otherwise.

Limits and common mistakes

Power belongs to a design and an assumed effect, not to an observed result. The so-called observed power, computed by inserting the observed effect into the formula, is for a given test a fixed function of the p-value §11.23 and adds no information.

A non-significant result from a low-power design is not evidence of no effect. To claim that an effect is negligible, fix a margin, the largest difference that does not matter, and use an equivalence test or show that the confidence interval §11.18 lies inside the margin.

Low power also distorts the results that do reach significance. When power is low, only the estimates that happened to come out large cross the threshold, so a significant estimate from an underpowered study tends to exaggerate the true effect.

A power calculation is only as good as its assumed σ\sigma and effect. An optimistic σ\sigma, an assumption of independence that does not hold, or lost data make the real power lower than planned.

With clustered data, power is governed by the number of clusters and the correlation §15.44 within them, not by the number of rows.

Correcting for multiple comparisons §11.26 lowers each test’s significance level and so lowers each test’s power. Plan nn with the corrected level.

Questions answered

How do variability, independent sample count, and effect size §11.24 change power?

For a fixed test and significance level, power rises with the effect size and with the number of independent units, and falls with the variability of the measurements. The reason is that power is governed by the ratio of the effect to the standard error of its estimate. For a difference of two means the standard error is σ2/n\sigma\sqrt{2/n}, where σ\sigma is the standard deviation of one measurement and nn the number of independent units per group. Doubling the effect doubles the ratio; doubling σ\sigma halves it; and restoring it needs four times as many units, because nn enters through its square root.

With σ=10\sigma = 10 milliseconds and a true effect of 2 milliseconds, a two-sided test at α=0.05\alpha = 0.05 has power of about 11% with 25 units per group and about 81% with 400. Only independent units count: many measurements from a few sessions or devices raise power only as far as the number of sessions or devices allows.

Related entries: Standard error (§11.15), Hypothesis test (§11.22), Effect size (§11.24), Pseudoreplication (§11.6), False positive and false negative (§1.22), Central limit theorem (§15.45).