Created
June 2, 2018 11:32
-
-
Save wviechtb/e87ee35ea5544a3a5f875f61e270cd18 to your computer and use it in GitHub Desktop.
Show density of product-moment correlation as a function of sample size
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
devtools::install_github("wviechtb/metafor") | |
library(metafor) | |
rs <- seq(-1,1,length=1001) | |
ns <- c(seq(10, 100, 10), 150, 200, 300) | |
ys <- lapply(ns, function(n) metafor:::.dcor(rs, n, rho=0)) | |
plot(NA, xlim=range(rs), ylim=range(ys), xlab="Correlation", ylab="Density") | |
invisible(lapply(ys, function(y) lines(rs, y))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment