weights (version 1.0.1)

wtd.cors: Produces weighted correlations quickly using C.

Description

wtd.cors produces a Pearsons correlation coefficient comparing two variables or matrices.

Usage

wtd.cors(x, y=NULL, weight=NULL)

Arguments

x

x should be a matrix or vector which the researcher wishes to correlate with y.

y

y should be a numerical vector or matrix which the researcher wishes to correlate with x. If y is NULL, x will be used instead

weight

weight is an optional vector of weights to be used to determining the weighted mean and variance for calculation of the correlations.

Value

A matrix of the estimated correlation coefficients.

See Also

wtd.cor stdz wtd.t.test wtd.chi.sq

Examples

Run this code
# NOT RUN {
test <- c(1,1,1,1,1,1,2,2,2,3,3,3,4,4)
t2 <- rev(test)
weight <- c(.5,.5,.5,.5,.5,1,1,1,1,2,2,2,2,2)

wtd.cors(test, t2)
wtd.cors(test, t2, weight)
# }

Run the code above in your browser using DataLab