calc.maxcor: Calculate maximum correlation

Description Usage Arguments Details Value Examples

View source: R/calc_maxcor.R

Description

Calculates the maximum absolute correlation between two matrices along the columns

Usage

1
calc.maxcor(x1, x2)

Arguments

x1

Named matrix 1

x2

Named matrix 2

Details

This function calculates the maximum absolute correlation for each column of x2 against each column of x1. The matrices are named and if the names overlap between x1 and x2, the correlation between the same named entries is set to zero.

Value

A vector of maximum absolute correlations

Examples

1
2
3
4
5
6
x1 <- matrix(rnorm(500), 100, 5)
x2 <- x1 + matrix(rnorm(500), 100, 5)
colnames(x1) <- c("A", "B", "C", "D", "E")
colnames(x2) <- c("A", "B", "C", "D", "E")
cor(x1, x2)
calc.maxcor(x1, x2)

SAVER documentation built on Nov. 14, 2019, 1:06 a.m.