Library · Validation

The positive control: a planted effect

Before concluding that nothing is there, check that the test could have seen something. A positive control adds an effect of known size to the data and measures how often the analysis detects it.

By , published

Definition

A negative result has two possible meanings: there is no effect, or the test is too weak to see one. The positive control separates them. Take the real data, add a synthetic effect of a size that would matter in practice, run the unchanged analysis, and repeat. The share of runs where the effect is detected is the power of the analysis for that size.

If a planted effect of realistic size is found in a small share of runs, the verdict on the real question is neither positive nor negative. It is an empty result: the data cannot answer.

Worked example

A treatment is compared with a control on a noisy outcome. We plant effects of several sizes and count how often a standard test detects them, for two sample sizes.

import numpy as np
from scipy import stats

rng = np.random.default_rng(9)

def detection_rate(n_per_group, effect, runs=2000):
    a = rng.normal(0.0, 1.0, (runs, n_per_group))
    b = rng.normal(effect, 1.0, (runs, n_per_group))
    return np.mean(stats.ttest_ind(a, b, axis=1).pvalue < 0.05)

print("planted effect (in standard deviations)   n = 30 per group   n = 300 per group")
for effect in (0.0, 0.1, 0.2, 0.5):
    print(f"{effect:25.1f} {detection_rate(30, effect):22.2f} {detection_rate(300, effect):19.2f}")

Output, produced by running the code above when this page was built:

planted effect (in standard deviations)   n = 30 per group   n = 300 per group
                      0.0                   0.04                0.06
                      0.1                   0.07                0.25
                      0.2                   0.12                0.67
                      0.5                   0.48                1.00

With 30 observations per group, an effect of 0.2 standard deviations is missed most of the time. A study of that size that finds nothing has learned nothing about effects of that order. The first line, with no effect planted, shows the false positive rate.

Where it misleads

  • The planted effect has a shape chosen by the analyst: a shift of the mean, a slope. The real effect may have another shape that the analysis would miss or find more easily.
  • The size to plant must come from what would matter for the decision, fixed beforehand. A size chosen after seeing the data can make any test look powerful or weak.
  • Several sizes should be planted. One point of the detection curve does not show where the test starts to see.
  • Low power also inflates the effects that do pass the threshold, as Button and co-authors documented for small studies: the significant results of a weak test overstate the truth.

The control pairs with the placebo. The placebo checks that the analysis finds nothing where there is nothing; the positive control checks that it finds something where there is something.

In our work

Our results have three possible verdicts: positive, negative, or empty. A negative is only reported when the planted effect was found; otherwise the result is recorded as empty, with the size the test could have seen.

References

  1. Button, K. S., Ioannidis, J. P. A., Mokrysz, C., et al. (2013). Power failure: why small sample size undermines the reliability of neuroscience. Nature Reviews Neuroscience, 14, 365-376. doi:10.1038/nrn3475
  2. Gelman, A., Carlin, J. (2014). Beyond power calculations: assessing type S (sign) and type M (magnitude) errors. Perspectives on Psychological Science, 9(6), 641-651. doi:10.1177/1745691614551642
  3. Cohen, J. (2013). Statistical power analysis for the behavioral sciences, 2nd edition. Routledge, New York (first published 1988). doi:10.4324/9780203771587

Have a question like this one on your own data? Tell us what you need in a few lines.

Send us the brief

Related pages

  • The placebo test: shuffled labelsShuffle the target, rerun everything, and look at the score. With no relation left between inputs and target, an honest pipeline scores at chance level. If it scores better, the pipeline is reading the answer somewhere.
  • The best of N trialsThe best result among many attempts carries a selection bias: it was kept because it was high. The more variants were tried, the better the best one looks, even when none has any real effect.
  • Paired comparison of two modelsTwo models tested on the same rows share most of their luck. Comparing their two confidence intervals ignores that. The interval of the difference, computed on the same resampled rows, is much narrower.
All library pages