Learn R Programming

SciencesPo (version 1.4.1)

WeightedCorrelation: Compute Weighted Correlations

Description

Compute the weighted correlation.

Usage

WeightedCorrelation(x, y = NULL, weights = NULL)

Arguments

x
a matrix or vector to correlate with y.
y
a matrix or vector to correlate with x. If y is NULL, x will be used instead.
weights
an optional vector of weights to be used to determining the weighted mean and variance for calculation of the correlations.

Examples

Run this code
 x <- sample(10,10)
 y <- sample(10,10)
 w <- sample(5,10, replace=TRUE)

WeightedCorrelation(x, y, w)

Run the code above in your browser using DataLab