Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demonstration that inaccurate original results lead to poor replication coverage (even with no bias)
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
You can’t perform that action at this time.