Every study here is run under the null hypothesis: the observations are N(0, 1), so a 5% test should give a false positive in 5% of studies. Optional stopping: test after every new observation and stop as soon as p < 0.05. Choosing the statistic: compute several test statistics and report the smallest p-value. Both raise the false positive rate well above 5%, and for optional stopping it tends to 1 as the patience grows.
Exact optional-stopping probability: the density of the running sum, restricted to the paths that have not stopped yet, is carried on a grid and convolved with the increment density between looks (Armitage, McPherson and Rowe 1969). The best-of-K probability for equicorrelated normal statistics is a one-dimensional integral. Both are computed in your browser with the same algorithm as the R code.
code/ch06_testing.R (functions optional_stopping_exact and best_of_k_fpr). This page reproduces the values (looks at 10, 11, ..., 100: 0.276360; looks at 10, 20, ..., 100: 0.193364; best of 5 independent statistics: 0.226219).