max_shift: Find the shift with the best correlation

Description Usage Arguments Value Examples

Description

For a number of correlation meansurements produced by trim_cor will return the shift with the highest correlation value.

Usage

1
max_shift(cor_measurements, value = FALSE)

Arguments

cor_measurements

vector of correlation values and shift

value

boolean, whether to return a numerical correlation value

Value

max_shift shift with the highest correlation. If value is TRUE then it will also return the correlation value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# create dummy dataset
l <- list()
for (i in 1:100) l[[i]] <- rnorm(100)
df <- as.data.frame(l)
names(df) <- paste("col", 1:100, sep = "_")
# order values (more obvious correlation shifts)
df <- apply(df, 2, sort)
out <- trim_cor(df[,1], df[,2], n = 5, p = 5)

max_shift(out)
max_shift(out, value = TRUE)

Swarchal/TISS documentation built on May 9, 2019, 3:24 p.m.