A kernel independence test for x and y with no conditioning set; run_test() errors if z is non-empty (use kci() to condition).

hsic(
  data,
  kernel = NULL,
  bandwidth = "heuristic",
  null_dist = "gamma",
  n_permutations = 100L,
  seed = 0
)

Arguments

data

A dataset() result or a data.frame.

kernel

NULL (default RBF kernel), one rbf_kernel() / linear_kernel() used for every column, or a named list of such kernels keyed by column name.

bandwidth

Bandwidth rule, "heuristic" (default) or "median".

null_dist

Null distribution, "gamma" (default) or "permutation".

n_permutations

Number of permutations (whole number >= 1); unused with the gamma null but always validated.

seed

Permutation seed (whole number, 0 to 2^53); unused with the gamma null.

Value

A fastcit_test bound to data.

Examples

df <- data.frame(X = rnorm(50), Y = rnorm(50))
run_test(hsic(dataset(df)), "X", "Y")
#> $statistic
#> [1] 12.19843
#> 
#> $p_value
#> [1] 0.5206906
#> 
#> $dof
#> NULL
#> 
#> $effect_size
#> [1] 0.05308995
#>