wcor: wcor

Description Usage Arguments Details Author(s) Examples

View source: R/fit.3g.R

Description

Finds a weighted correlation of two vectors x and y

Usage

1
wcor(x, y, weights = rep(1, length(x)))

Arguments

x

first vector

y

second vector of same length as x

weights

vector of weights of same length as x and y

Details

Weighting procedure is equivalent to counting value {x[i],y[i]} with multiplicity weights[i]

Author(s)

James Liley

Examples

1
2
3
4
nn=100000
x=(1:10)/10 +runif(10); y=(1:10)/10 +runif(10)
mult=c(1:3,4:6,4:6,7:10,7:10,7:10); weights=c(1,1,1,2,2,2,3,3,3,3)
print(c(cor(x[mult],y[mult]),wcor(x,y,weights=weights)))

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.