(Taken from tourr package) Computes the distance correlation based index on 2D projections of the data.

sc_dcor(x, y)

Arguments

x

numeric vector

y

numeric vector

Value

A "numeric" object that gives the plot's dcor score.

Examples

  require(ggplot2)
  require(tidyr)
#> Loading required package: tidyr
  require(dplyr)
  data(anscombe)
  anscombe_tidy <- anscombe %>%
  pivot_longer(cols = everything(),
    names_to = c(".value", "set"),
    names_pattern = "(.)(.)")
  ggplot(anscombe_tidy, aes(x=x, y=y)) +
    geom_point() +
    facet_wrap(~set, ncol=2, scales = "free")

  sc_dcor(anscombe$x1, anscombe$y1)
#> [1] 0.8239139
  sc_dcor(anscombe$x2, anscombe$y2)
#> [1] 0.8688329
  sc_dcor(anscombe$x3, anscombe$y3)
#> [1] 0.9064762
  sc_dcor(anscombe$x4, anscombe$y4)
#> [1] 0.8067981