Compute the weighted covariance among variables in a matrix or between the variables in two separate matrices/vectors.
Usage
wt_cov(x, y = NULL, wt = NULL, as_cor = FALSE, use = "everything")
wt_cor(x, y = NULL, wt = NULL, use = "everything")
Arguments
x
Vector or matrix of x variables.
y
Vector or matrix of y variables
wt
Vector of weights
as_cor
Logical scalar that determines whether the covariances should be standardized (TRUE) or unstandardized (FALSE).
use
Method for handling missing values. "everything" uses all values and does not account for missingness, "listwise" uses only complete cases, and "pairwise" uses pairwise deletion.