Skip to content

Instantly share code, notes, and snippets.

@akbertram
Last active December 20, 2015 10:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akbertram/87126966fe15f1790ed8 to your computer and use it in GitHub Desktop.
Save akbertram/87126966fe15f1790ed8 to your computer and use it in GitHub Desktop.
require(energy)
# Find correlated pairs of variables
# in a simulated dataset
findCorellations <- function(pairs, n) {
for(i in 1:pairs) {
dx <- rnorm(n)
dy <- rnorm(n)
dcor <- DCOR(dx, dy)
print(dcor$dCor)
}
}
# Time the calculation for increasing number of
# observations
for(n in c(1000,2000,5000,6000,7000,8000,10000,25000)) {
cat(sprintf("n = %d\n",n))
print(system.time(findCorellations(10,n)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment