powered by
Computes the weighted correlation between two distributions. This can be Pearson, Spearman or Kendall correlation.
weighted.cor(x, y, weights = NULL, method = "pearson", na.rm = FALSE)
a length-one numeric vector
numeric vector
numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.
a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman".
logical, indicating whether NA values should be silently removed before the computation proceeds. Default is FALSE.
Nicolas Robette
weighted.sd, weighted.cor2
weighted.sd
weighted.cor2
data(Movies) weighted.cor(Movies$Critics, Movies$BoxOffice, weights = rep(c(.8,1.2), 500)) weighted.cor(Movies$Critics, Movies$BoxOffice, weights = rep(c(.8,1.2), 500), method = "spearman")
Run the code above in your browser using DataLab