Skip to content

Instantly share code, notes, and snippets.

@akbertram akbertram/dcor-bench.R Secret
Last active Dec 20, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.