R/taylor_correlation.R

Defines functions cor_taylor

Documented in cor_taylor

##' cor_taylor function
##'
##' A function to compute Taylor's correlation coefficient ;-)
##'
##' @param X a numeric matrix with number of rows bigger than the number of columns
##' @return Taylor's correlation coefficient, a number between 0 and 1 expressing the amount of dependence between multiple variables.
##' @export


cor_taylor <- function(X){
    if(!inherits(X,"matrix")){
        stop("Input must be inherit 'matrix' class.")
    }
    n <- ncol(X)
    return((1/sqrt(n))*sd(eigen(cor(X))$values))
}

Try the miscFuncs package in your browser

Any scripts or data that you put into this service are public.

miscFuncs documentation built on Nov. 2, 2023, 5:21 p.m.