Created
August 30, 2015 17:30
-
-
Save richarddmorey/db65d83de20fbc06d5ad to your computer and use it in GitHub Desktop.
Demonstration that inaccurate original results lead to poor replication coverage (even with no bias)
This file contains 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
N1 = 10 # Participants in "original"; inaccurate | |
N2 = 200 # Participants in "replication"; accurate | |
M = 100000 # number of simulations | |
# CI setup | |
alpha = .05 | |
zstar = qnorm(1-alpha/2) | |
# Sample means | |
Xbar1 = rnorm(M, 0, 1/sqrt(N1)) # Original | |
Xbar2 = rnorm(M, 0, 1/sqrt(N2)) # Replication | |
# Does the "replication" CI include the "original" mean? | |
CI.in = (Xbar1 < (Xbar2 + zstar/sqrt(N2))) & (Xbar1 > (Xbar2 - zstar/sqrt(N2))) | |
# Proportion containing original mean | |
mean(CI.in) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment