View source: R/calc_weighted_corr.R
calc_weighted_corr | R Documentation |
Calculate weighted correlation
calc_weighted_corr(a, b, w = rep(1, nrow(a))/nrow(a))
a |
numeric matrix |
b |
numeric matrix |
w |
alteration weights |
a weighted correlation (similarity) matrix
Rileen Sinha (rileen@gmail.com), Augustin Luna (aluna@jimmy.harvard.edu)
t1 <- as.matrix(c(1,1,1,1,1,1,2,2,2,3,3,3,4,4)) t2 <- as.matrix(rev(t1)) weight <- c(.5,.5,.5,.5,.5,1,1,1,1,2,2,2,2,2) calc_weighted_corr(t1, t2, weight)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.