Skip to contents

Uses the underlying c++ implementation of ici_kt to provide a fast version of Kendall-tau correlation.

Usage

kt_fast(
  x,
  y = NULL,
  use = "everything",
  alternative = "two.sided",
  continuity = FALSE,
  return_matrix = TRUE
)

Arguments

x

a numeric vector, matrix, or data frame.

y

NULL (default) or a vector.

use

an optional character string giving a method for computing correlations in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", or "pairwise.complete.obs".

alternative

the type of test

continuity

should a continuity correction be applied

return_matrix

Should the matrices of values be returned, or a long data.frame

Value

a list of matrices, tau, pvalue, or a data.frame.

Details

Although the interface is mostly identical to the built-in stats::cor() method, there are some differences.

  • if only x is provided as a matrix or data.frame, the columns must be named.

  • if providing both x and y, it is assumed they are both single vectors.

  • if NA values are present, this function does not error, but will either remove them or return NA, depending on the option.

  • "na.or.complete" is not a valid option for use.

  • A named list with matrices or data.frame is returned, with the tau and pvalue values.