powered by
Calculates weighted Pearson correlation coefficient between actual and predicted values by the help of stats::cov.wt().
stats::cov.wt()
weighted_cor(actual, predicted, w = NULL, na.rm = FALSE, ...)
A length-one numeric vector.
Observed values.
Predicted values.
Optional case weights.
Should observations with missing values in actual or predicted be removed? Default is FALSE.
actual
predicted
FALSE
Further arguments passed to stats::cov.wt().
weighted_cor(1:10, c(1, 1:9)) weighted_cor(1:10, c(1, 1:9), w = 1:10)
Run the code above in your browser using DataLab