Description Usage Arguments Value Examples
This function is for calculating the correlation between two vectors x
and y
. The vectors are shifted n
times by p
elements.
This relates to shifted n number of concentrations in either direction, each
concentration shift being a multiple of the number of features.
1 |
x |
vector |
y |
vector |
n |
integer. The number of titrations shifts in either directions. i.e
|
p |
interger. The number of features. |
metadata |
optional metadata object produced from
|
cor_measurements vector of correlations for each shift
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # 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)
plot(out, type = "l")
# plot all correlations
out <- trim_cor(df[,1], df[,2], 20, 3)
plot(out,
type = "l",
xaxt = "n",
ylab = "correlation",
main = "col_1 vs all correlation",
sub = "20 shifts, 3 elements each")
axis(1, at = 1:41,
labels = names(out))
for (i in 3:ncol(df)){
lines(trim_cor(df[,1], df[,i], 20, 3), col = "gray50")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.