Created
September 6, 2019 09:55
-
-
Save lgatto/d8eb59effb815996eac789debb51690d to your computer and use it in GitHub Desktop.
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
set.seed(123) | |
max_corrs <- function(d, n = 60, n_iter = 1000) | |
replicate(n_iter, { | |
m <- matrix(rnorm(n * d), ncol = d) | |
max(cor(m)[-1, 1]) | |
}) | |
r1 <- data.frame(d = 800, r = max_corrs(800)) | |
r2 <- data.frame(d = 6400, r = max_corrs(6400)) | |
r <- rbind(r1, r2) | |
ggplot2::ggplot(r, aes(x = r, fill = factor(d), alpha = 0.5)) + | |
ggplot2::geom_density() + | |
ggplot2::scale_alpha(guide = "none") + | |
ggplot2::labs(fill = "Dimensions") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment