Last active
February 26, 2019 10:44
-
-
Save Remi-Gau/86ad7c9edc88c7acb8fae66024bba70d to your computer and use it in GitHub Desktop.
p-hacking "increases power"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% small matlab script to show how p-hacking "increases power" : | |
% number of false negatives drops as more studies are "p-hacked" | |
% from Iaonnidis 2005; table 2 ; DOI: 10.1371/journal.pmed.0020124 | |
R = 0.1; % pre-study odds | |
u = 0:.02:1; % bias : proportion of study that should have given a | |
% negative but turn out positive (QRPs or other errors). | |
c = 100; %number of relationship tested | |
alpha = 0.05; | |
beta = 0.5; | |
FN = (1 - u) * c * beta * R / (R + 1); | |
FP = c * alpha + u * c * (1 - alpha) / (R + 1); | |
figure(1) | |
clf | |
hold on | |
plot(1:numel(u), FN, 'r') | |
plot(1:numel(u), FP, 'b') | |
set(gca, 'xtick', linspace(1, numel(u), 11),... | |
'xticklabel', linspace(0, 1, 11)) | |
xlabel('bias') | |
axis([0 numel(u) 0 100]) | |
legend({'false negatives', 'false positives'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment