November 14, 2018

*by Angelika Stefan & Felix Schönbrodt*

Almost all researchers have experienced the tingling feeling of suspense that arises right before they take a look at long-awaited data: Will they support their favored hypothesis? Will they yield interesting or even groundbreaking results? In a perfect world (especially one without publication bias), the cause of this suspense should be nothing else but scientific curiosity. However, the world, and specifically the incentive system in science, is not perfect. A lot of pressure rests on researchers to produce statistically significant results. For many researchers, statistical significance is the cornerstone of their academic career, so non-significant results in an important study can not only question their scientific convictions but also crash their hopes of professional promotion. (Although, fortunately things are changing for the better).

Now, what does a researcher do confronted with messy, non-significant results? According to several much-cited studies (for example John et al., 2012; Simmons et al., 2011), a common reaction is to start sampling again (and again, and again, …) in the hope that a somewhat larger sample size can boost significance. Another reaction is to wildly conduct hypothesis tests on the existing sample until at least one of them becomes significant (see for example: Simmons et al., 2011; Kerr, 1998 ). These practices, along with some others, are commonly known as *p-hacking*, because they are designed to drag the famous *p*-value right below the mark of .05 which usually indicates statistical significance. Undisputedly, *p*-hacking works (for a demonstration try out the p-hacker app). The two questions we want to answer in this blog post are: How does it work and why is that bad for science?

As many people may have heard, *p*-hacking works because it exploits a process called *alpha error accumulation* which is covered in most introductory statistics classes (but also easily forgotten again). Basically, alpha error accumulation means that as one conducts more and more hypothesis tests, the probability increases that one makes a wrong test decision at least once. Specifically, this wrong test decision is a false positive decision or *alpha error*, which means that you proclaim the existence of an effect although, in fact, there is none. Speaking in statistical terms, an alpha error occurs when the test yields a significant result although the null hypothesis (“There is no effect”) is true in the population. This means that *p*-hacking leads to the publication of an increased rate of false positive results, that is, studies that claim to have found an effect although, in fact, their result is just due to the randomness of the data. Such studies will never replicate.

At this point, the blog post could be over. *P*-Hacking exploits alpha error accumulation and fosters the publication of false positive results which is bad for science. However, we want to take a closer look at *how* bad it really is. In fact, some *p*-hacking techniques are worse than others (or, if you like the unscrupulous science villain perspective: some *p*-hacking techniques work better than others). As a showcase, we want to introduce two researchers: The *HARKer* takes existing data and conducts multiple independent hypothesis tests (based on multiple uncorrelated variables in the data set) with the goal to publish the ones that become significant. For example, the HARKer tests for each possible correlation in a large data set whether it differs significantly from zero. On the other hand, the *Accumulator* uses optional stopping. This means that he collects data for a single research question test in a sequential manner until either statistical significance or a maximum sample size is reached. For simplicity, we assume that they use neither other *p*-hacking techniques nor other questionable research practices.

Let us start with the HARKer: Since the conducted hypothesis tests in our defined scenario are essentially independent, the situation can be seen as a problem of multiple testing. This means, it is comparatively easy to determine the exact probability that the HARKer will end up with at least one false-positive result given a certain number of hypothesis tests. Assuming no effects in the population (for example, no correlation between the variables), one can picture the situation as a decision tree: At each branch level stands a hypothesis test which can either result in a non-significant result with 95% probability or in a (spurious) significant result with 5% probability, which is the level.

No matter how many hypothesis tests the HARKer conducts, there will only be one condition in the all-null scenario where no error occurs, that is, where all hypothesis tests yield non-significant results. The probability that this occurs can be calculated by , with being the number of conducted hypothesis tests. The probability that at least one of the hypothesis tests is significant is the probability of the complementary event, that is . For example, when the HARKer computes hypothesis with an alpha level of , the overall probability to obtain at least one false positive result is . Of course, the formula can be adjusted for other suggested alpha levels, such as or . We show this general formula in the R-code chunk below.

The Accumulator has a different tactic: Instead of conducting multiple hypothesis tests on different variables of one data set, he repeatedly conducts the same hypothesis test on the same variables in a growing sample. Starting with a minimum sample size, the Accumulator looks at the results of the analysis – if these are significant, data collection is stopped, if not, more data is collected until (finally) the results become significant, or a maximum sample size is reached. This strategy is also called *Optional Stopping*. Of course, the more often a researcher peeks at the data, the higher is the probability to obtain a false positive result at least once. However, this overall probability is not the same as the one obtained through HARKing. The reason is that the hypothesis tests are not independent in this case. Why is that? The same hypothesis test is repeatedly conducted on only slightly different data. In fact, the data that were used in in the first hypothesis test are used in every single of the subsequent hypothesis tests so that there is a spillover effect of the first test to every other hypothesis test in the set. Imagine, your initial sample contains an outlier: This outlier will affect the test results in any other test. With multiple testing, in contrast, the outlier will affect only the test in question but none of the other tests in the set.

So does this dependency make optional stopping more or less effective than HARKing? Of course, people have been wondering about this for quite a while. A paper by Armitage et al. (1969) demonstrates error accumulation in optional stopping for three different tests. We can replicate their results for the *z*-test with a small simulation (a more flexible simulation can be found at the end of the blog post): We start by drawing a large number of samples (`iter`) with the maximum sample size (`n.max`) from the null hypothesis. Then we conduct a sequential testing procedure on each of the samples, starting with a minimum sample size (`n.min`) and going up in several steps (`step`) up to the maximum sample size. The probability to obtain a significant result at least once up to a certain step can be estimated through the percentage of iterations that end up with at least one significant result at that point.

# The Problem of optional stopping

accumulator <- function(n.min, n.max, step, alpha=0.05, iter=10000){

# Determine places of peeks

peeks <- seq(n.min, n.max, by=step)

# Initialize result matrix (non-sequential)

res <- matrix(NA, ncol=length(peeks), nrow=iter)

colnames(res) <- peeks

# Conduct sequential testing (always until n.max, with peeks at pre-determined places)

for(i in 1:iter){

sample <- rnorm(n.max, 0, 1)

res[i,] <- sapply(peeks, FUN=function(x){sum(sample[1:x])/sqrt(x)})

}

# Create matrix: Which tests are significant?

signif <- abs(res) >= qnorm(1-alpha)

# Create matrix: Has there been at least one significant test in the trial?

seq.signif <- matrix(NA, ncol=length(peeks), nrow=iter)

for(i in 1:iter){

for(j in 1:ncol(signif)){

seq.signif[i,j] <- TRUE %in% signif[i, 1:j]

}

}

# Determine the sequential alpha error probability for the sequential tests

seq.alpha <- apply(seq.signif, MARGIN = 2, function(x){sum(x)/iter})

# Return a list of individual test p-values, sequential significance and sequential alpha error probability

return(list(seq.alpha = seq.alpha))

}

accumulator <- function(n.min, n.max, step, alpha=0.05, iter=10000){

# Determine places of peeks

peeks <- seq(n.min, n.max, by=step)

# Initialize result matrix (non-sequential)

res <- matrix(NA, ncol=length(peeks), nrow=iter)

colnames(res) <- peeks

# Conduct sequential testing (always until n.max, with peeks at pre-determined places)

for(i in 1:iter){

sample <- rnorm(n.max, 0, 1)

res[i,] <- sapply(peeks, FUN=function(x){sum(sample[1:x])/sqrt(x)})

}

# Create matrix: Which tests are significant?

signif <- abs(res) >= qnorm(1-alpha)

# Create matrix: Has there been at least one significant test in the trial?

seq.signif <- matrix(NA, ncol=length(peeks), nrow=iter)

for(i in 1:iter){

for(j in 1:ncol(signif)){

seq.signif[i,j] <- TRUE %in% signif[i, 1:j]

}

}

# Determine the sequential alpha error probability for the sequential tests

seq.alpha <- apply(seq.signif, MARGIN = 2, function(x){sum(x)/iter})

# Return a list of individual test p-values, sequential significance and sequential alpha error probability

return(list(seq.alpha = seq.alpha))

}

For example, the researcher conducts a two-sided one-sample *z*-test with an overall level of .05 in a sequential way. He starts with 10 observations, then always adds another 10 if the result is not significant, up to 100 observations at maximum. This means, he has 10 chances to peek at the data and end the data collection if the hypothesis test is significant. Using our simulation function, we can determine the probability to have obtained at least one false positive result at any of these steps:

[1] 0.0492 0.0824 0.1075 0.1278 0.1431 0.1574 0.1701 0.1788 0.1873 0.1949

We can see that with one single evaluation, the false positive rate is at the nominal 5%. However, when more in-between tests are calculated, the false positive rate rises to roughly 20% with ten peeks. This means that even if there is no effect at all in the population, the researcher would have stopped data collection with a signficant result in 20% of the cases.

Let’s compare the false positive rates of HARKing and optional stopping: Since the researcher in our example above conducts one to ten dependent hypothesis tests, we can compare this to a situation where a HARKer conducts one to ten independent hypothesis tests. The figure below shows the results of both *p*-hacking strategies:

# HARKing False Positive Rates

HARKs <- harker(1:10, alpha=0.05)

HARKs <- harker(1:10, alpha=0.05)

We can see that HARKing produces higher false positive rates than optional stopping with the same number of tests. This can be explained through the dependency on the first sample in the case of optional stopping: Given that the null hypothesis is true, this sample is not very likely to show extreme effects in any direction (however, there is a small probability that it does). Every extension of this sample has to “overcome” this property not only by being extreme in itself but also by being extreme enough to shift the test on the overall sample from non-significance to significance. In contrast, every sample in the multiple testing case only needs to be extreme in itself. Note, however, that false positive rates in optional stopping are not only dependent on the number of interim peeks, but also on the size of the initial sample and on the step size (how many observations are added between two peeks?). The difference between multiple testing and optional stopping which you see in the figure above is therefore only valid for this specific case. Going back to the two researchers from our example, we can say that the HARKer has a better chance to come up with significant results than the Accumulator, if both do the same number of hypothesis tests.

You can use the interactive *p*-hacker app to experience the efficiency of both *p*-hacking strategies yourself: You can increase the number of dependent variables and see whether one of them gets significant (HARing), or you can got to the “Now: p-hack!” tab and increase your sample until you obtain significance. Note that the DVs in the p-hacker app are not completely independent as in our example above, but rather correlate with *r* = .2, assuming that the DVs to some extent measure at least related constructs.

To conclude, we have shown how two *p*-hacking techniques work and why their application is bad for science. We found out that *p*-hacking techniques based on multiple testing typically end up with higher rates of false positive results than *p*-hacking techniques based on optional stopping, if we assume the same number of hypothesis tests. We want to stress that this does *not* mean that naive optional stopping is okay (or even okay-ish) in frequentist statistics, even if it does have a certain appeal. For those who want to do guilt-free optional stopping, there are ways to control for the error accumulation in the frequentist framework (see for example Wald, 1945, Chow & Chang, 2008, Lakens, 2014) and sequential Bayesian hypothesis tests (see for example our paper on sequential hypothesis testing with Bayes factors or Rouder, 2014).

sim.optstopping <- function(n.min, n.max, step, alpha=0.05, test="z.test", alternative="two.sided", iter=10000){

match.arg(test, choices=c("t.test", "z.test"))

match.arg(alternative, choices=c("two.sided", "directional"))

# Determine places of peek

peeks <- seq(n.min, n.max, by=step)

# Initialize result matrix (non-sequential)

res <- matrix(NA, ncol=length(peeks), nrow=iter)

colnames(res) <- peeks

# Conduct sequential testing (always until n.max, with peeks at pre-determined places)

for(i in 1:iter){

sample <- rnorm(n.max, 0, 1)

if(test=="t.test"){res[i,] <- sapply(peeks, FUN=function(x){mean(sample[1:x])/sd(sample[1:x])*sqrt(x)})}

if(test=="z.test"){res[i,] <- sapply(peeks, FUN=function(x){sum(sample[1:x])/sqrt(x)})}

}

# Create matrix: Which tests are significant?

if(test=="z.test"){

ifelse(alternative=="two.sided", signif <- abs(res) >= qnorm(1-alpha), signif <- res <= qnorm(alpha))

}else if (test=="t.test"){

n <- matrix(rep(peeks, iter), nrow=iter, byrow=T)

ifelse(alternative=="two.sided", signif <- abs(res) >= qt(1-alpha, df=n-1), signif <- res <= qt(alpha, df=n-1))

}

# Create matrix: Has there been at least one significant test in the trial?

seq.signif <- matrix(NA, ncol=length(peeks), nrow=iter)

for(i in 1:iter){

for(j in 1:ncol(signif)){

seq.signif[i,j] <- TRUE %in% signif[i, 1:j]

}

}

# Determine the sequential alpha error probability for the sequential tests

seq.alpha <- apply(seq.signif, MARGIN = 2, function(x){sum(x)/iter})

# Return a list of individual test p-values, sequential significance and sequential alpha error probability

return(list(p.values = res,

seq.significance = seq.signif,

seq.alpha = seq.alpha))

}

match.arg(test, choices=c("t.test", "z.test"))

match.arg(alternative, choices=c("two.sided", "directional"))

# Determine places of peek

peeks <- seq(n.min, n.max, by=step)

# Initialize result matrix (non-sequential)

res <- matrix(NA, ncol=length(peeks), nrow=iter)

colnames(res) <- peeks

# Conduct sequential testing (always until n.max, with peeks at pre-determined places)

for(i in 1:iter){

sample <- rnorm(n.max, 0, 1)

if(test=="t.test"){res[i,] <- sapply(peeks, FUN=function(x){mean(sample[1:x])/sd(sample[1:x])*sqrt(x)})}

if(test=="z.test"){res[i,] <- sapply(peeks, FUN=function(x){sum(sample[1:x])/sqrt(x)})}

}

# Create matrix: Which tests are significant?

if(test=="z.test"){

ifelse(alternative=="two.sided", signif <- abs(res) >= qnorm(1-alpha), signif <- res <= qnorm(alpha))

}else if (test=="t.test"){

n <- matrix(rep(peeks, iter), nrow=iter, byrow=T)

ifelse(alternative=="two.sided", signif <- abs(res) >= qt(1-alpha, df=n-1), signif <- res <= qt(alpha, df=n-1))

}

# Create matrix: Has there been at least one significant test in the trial?

seq.signif <- matrix(NA, ncol=length(peeks), nrow=iter)

for(i in 1:iter){

for(j in 1:ncol(signif)){

seq.signif[i,j] <- TRUE %in% signif[i, 1:j]

}

}

# Determine the sequential alpha error probability for the sequential tests

seq.alpha <- apply(seq.signif, MARGIN = 2, function(x){sum(x)/iter})

# Return a list of individual test p-values, sequential significance and sequential alpha error probability

return(list(p.values = res,

seq.significance = seq.signif,

seq.alpha = seq.alpha))

}

| Trackback

June 25, 2018

In 2015, the psychology department at LMU Munich for the first time announced a professorship position with an “open science statement” (see original job description here):

Our department embraces the values of open science and strives for replicable and reproducible research. For this goal we support transparent research with open data, open materials, and study pre-registration. Candidates are asked to describe in what way they already pursued and plan to pursue these goals.

Since then, every professorship announcement contained this paragraph (and we made good experiences with it).

I am very happy to announce that my department now turned this implicit policy into an explicit hiring policy, effective since May 2018: **The department’s steering committee unanimously voted for an explicit policy to always include this (or a similar) statement to all future professorship job advertisements.**

It is the task of the appointment committee to value the existing open science activities as well as future commitments of applicants appropriately. By including this statement, our department aims to communicate core values of good scientific practice and to attract excellent researchers who aim for transparent and credible research.

In this respect, take a look at the current draft of a *Modular Certification Initiative* (initiated by Chris Chambers, Kyle MacDonald and me, with a lot of input from the open science community). With this TOP-like scheme, institutions, but also single researchers, can select a level of openness which they require in their hiring process.

So, if you want to join the LMU psychology department as a professor, you should better have some open science track record.

June 1, 2017

It is well known that publication bias and *p*-hacking inflate effect size estimates from meta-analyses. In the last years, methodologists have developed an ever growing menu of statistical approaches to correct for such overestimation. However, to date it was unclear under which conditions they perform well, and what to do if they disagree. Born out of a Twitter discussion, Evan Carter, Joe Hilgard, Will Gervais and I did a large simulation project, where we compared the performance of naive random effects meta-analysis (RE), trim-and-fill (TF),* p*-curve, *p*-uniform, PET, PEESE, PET-PEESE, and the three-parameter selection model (3PSM).

Previous investigations typically looked only at publication bias *or* questionable research practices QRPs (but not both), used non-representative study-level sample sizes, or only compared few bias-correcting techniques, but not all of them. Our goal was to simulate a research literature that is as realistic as possible for psychology. In order to simulate several research environments, we fully crossed five experimental factors: (1) the true underlying effect, δ (0, 0.2, 0.5, 0.8); (2) between-study heterogeneity, τ (0, 0.2, 0.4); (3) the number of studies in the meta-analytic sample, *k* (10, 30, 60, 100); (4) the percentage of studies in the meta-analytic sample produced under publication bias (0%, 60%, 90%); and (5) the use of QRPs in the literature that produced the meta-analytic sample (none, medium, high).

This blog post summarizes some insights from our study, internally called “meta-showdown”. Check out the preprint; and the interactive app metaExplorer. The fully reproducible and reusable simulation code is on Github, and more information is on OSF.

In this blog post, I will highlight some lessons that we learned during the project, primarily focusing on **what not do to when performing a meta-analysis**.

**Constraints on Generality disclaimer: These recommendations apply to typical sample sizes, effect sizes, and heterogeneities in psychology; other research literatures might have different settings and therefore a different performance of the methods. Furthermore, the recommendations rely on the modeling assumptions of our simulation. We went a long way to make them as realistic as possible, but other assumptions could lead to other results.**

If studies have no publication bias, nothing can beat plain old random effects meta-analysis: it has the highest power, the least bias, and the highest efficiency compared to all other methods. Even in the presence of some (though not extreme) QRPs, naive RE performs better than all other methods. When can we expect no publication bias? If (and, in my opinion *only if*) we meta-analyze a set of registered reports.

But.

In *any* other setting except registered reports, a consequential amount of publication bias must be expected. In the field of psychology/psychiatry, more than 90% of all published hypothesis tests are significant (Fanelli, 2011) despite the average power being estimated as around 35% (Bakker, van Dijk, & Wicherts, 2012) – the gap points towards a huge publication bias. In the presence of publication bias, naive random effects meta-analysis and trim-and-fill have false positive rates approaching 100%:

More thoughts about trim-and-fill’s inability to recover δ=0 are in Joe Hilgard’s blog post. (Note: this insight is not really new and has been shown multiple times before, for example by Moreno et al., 2009, and Simonsohn, Nelson, and Simmons, 2014).

**Our recommendation: Never trust meta-analyses based on naive random effects and trim-and-fill, unless you can rule out publication bias. Results from previously published meta-analyses based on these methods should be treated with a lot of skepticism.
**

*Update 2017/06/09:* We had a productive exchange with Uri Simonsohn and Joe Simmons concerning what should be estimated in a meta-analysis with heterogeneity. Traditionally, meta-analysts have tried to arrive at techniques that recover the true average effect of all conducted studies (AEA – average effect of all studies). Simonsohn et al (2014) propose estimating a different magnitude; the average effect of the studies one observes, rather than of all studies (AEO – average effect of observed studies). See Simonsohn et al (2014), the associated Supplementary Material 2, and also this blog post for arguments why they think this is a more useful quantity to estimate.

Hence, an investigation of the topic can be done on two levels: A) What is the more appropriate estimand (AEA or AEO?), and B) Under what conditions are estimators able to recover the respective true value with the least bias and least variance?

Instead of updating the section of the current blog post in the light of our discussion, I decided to cut it out and to move the topic to a future blog post. Likewise, one part of our manuscript’s revision will be a more detailed discussion about excatly these differences.

I archived the previous version of the blog post here.

Many bias-correcting methods are driven by QRPs – the more QRPs, the stronger the downward correction. However, this effect can get so strong, that methods overadjust into the opposite direction, even if all studies in the meta-analysis are of the same sign:

Note: You need to set the option “Keep negative estimates” to get this plot.

**Our recommendation: Ignore bias-corrected results that go into the opposite direction; set the estimate to zero, do not reject H₀.
**

Typical small-study effects (e.g., by *p*-hacking or publication bias) induce a negative correlation between sample size and effect size – the smaller the sample, the larger the observed effect size. PET-PEESE aims to correct for that relationship. In the absence of bias and QRPs, however, random fluctuations can lead to a *positive* correlation between sample size and effect size, which leads to a PET and PEESE slope of the unintended sign. Without publication bias, this reversal of the slope actually happens quite often.

See for example the next figure. The true effect size is zero (red dot), naive random effects meta-analysis slightly overestimates the true effect (see black dotted triangle), but PET and PEESE massively overadjust towards more positive effects:

As far as I know, PET-PEESE is typically not intended to correct in the reverse direction. An underlying biasing process would have to systematically remove small studies that show a significant result with larger effect sizes, and keep small studies with non-significant results. In the current incentive structure of psychological research, I see no reason for such a process, unless researchers are motivated to show that a (maybe politically controversial) effect does not exist.

**Our recommendation: Ignore the PET-PEESE correction if it has the wrong sign, unless there are good reasons for an untypical selection process.
**

A bias can be more easily accepted if it always is conservative – then one could conclude: “This method might miss some true effects, but *if* it indicates an effect, we can be quite confident that it really exists”. Depending on the conditions (i.e., how much publication bias, how much QRPs, etc.), however, PET/PEESE sometimes shows huge overestimation and sometimes huge underestimation.

For example, with no publication bias, some heterogeneity (τ=0.2), and severe QRPs, PET/PEESE *underestimates* the true effect of δ = 0.5:

In contrast, if no effect exists in reality, but strong publication bias, large heterogeneity and no QRPs, PET/PEESE *overestimates* at lot:

In fact, the distribution of PET/PEESE estimates looks virtually identical for these two examples, although the underlying true effect is δ = 0.5 in the upper plot and δ = 0 in the lower plot. Furthermore, note the huge spread of PET/PEESE estimates (the error bars visualize the 95% quantiles of all simulated replications): Any single PET/PEESE estimate can be very far off.

**Our recommendation: As one cannot know the condition of reality, it is probably safest not to use PET/PEESE at all.
**

Again, please consider the “Constraints on Generality” disclaimer above.

- When you can exclude publication bias (i.e., in the context of registered reports), do not use bias-correcting techniques. Even in the presence of some QRPs they perform worse than plain random effects meta-analysis.
- In any other setting except registered reports, expect publication bias, and do not use random effects meta-analysis or trim-and-fill. Both will give you a 100% false positive rate in typical settings, and a biased estimation.
- Even if all studies entering a meta-analysis point into the same direction (e.g., all are positive), bias-correcting techniques sometimes overadjust and return a significant estimate of the
*opposite*direction. Ignore these results, set the estimate to zero, do not reject H₀. - Sometimes PET/PEESE adjust into the wrong direction (i.e., increasing the estimated true effect size)

As with any general recommendations, there might be good reasons to ignore them.

- The
*p*-uniform package (v. 0.0.2) very rarely does not provide a lower CI. In this case, ignore the estimate. - Do not run
*p*-curve or*p*-uniform on <=3 significant and directionally consistent studies. Although computationally possible, this gives hugely variable results, which are often very biased. See our supplemental material for more information and plots. - If the 3PSM method (in the implementation of McShane et al., 2016) returns an incomplete covariance matrix, ignore the result (even if a point estimate is provided).

Send this to a friend