set.seed (100) ## creating test data
n <- 1000
x <- rnorm (n)
y <- x+ rnorm (n)
tim <- proc.time ()[1] ## applying cor.fk
cor.fk (x, y)
cat ("cor.fk runtime [s]:", proc.time ()[1] - tim, "(n =", length (x), ")\n")
tim <- proc.time ()[1] ## applying cor (standard R implementation)
cor (x, y, method = "kendall")
cat ("cor runtime [s]:", proc.time ()[1] - tim, "(n =", length (x), ")\n")
## applying cor and cor.fk on data containing
Xt <- cbind (c (x, as.integer (x)), c (y, as.integer (y)))
tim <- proc.time ()[1] ## applying cor.fk
cor.fk (Xt)
cat ("cor.fk runtime [s]:", proc.time ()[1] - tim, "(n =", nrow (Xt), ")\n")
tim <- proc.time ()[1] ## applying cor (standard R implementation)
cor (Xt, method = "kendall")
cat ("cor runtime [s]:", proc.time ()[1] - tim, "(n =", nrow (Xt), ")\n")
Run the code above in your browser using DataLab