weighted.cov: Weighted bivariate covariance

View source: R/pv_rrepest_correlation.R View source: R/weighted_covariance.R

weighted.covR Documentation

Weighted bivariate covariance

Description

Computes the weighted covariance coefficient of two numeric vectors.

Usage

weighted.cov(x, y, w, na.rm = TRUE)

Arguments

x

(numeric vector) Variable of interest x for computing the covariance

y

(numeric vector) Variable of interest y for computing the covariance

w

(numeric vector) Vector with the weights

na.rm

(bool) if TRUE: Excludes missing values before computing the covariance

Value

Scalar containing the covariance

Examples

data(df_talis18) 

weighted.cov(x = df_talis18$t3stake, y = df_talis18$t3team, w = df_talis18$tchwgt)

Rrepest documentation built on April 4, 2025, 2:07 a.m.