View source: R/biweight_midcovariance.R
biweight_midcovariance | R Documentation |
This function computes the biweight midcovariance, a robust measure of covariance between two numerical vectors. The biweight midcovariance is less sensitive to outliers than the traditional covariance.
biweight_midcovariance(x, y)
x |
A numeric vector. |
y |
A numeric vector of the same length as |
The biweight midcovariance between x
and y
.
Christian L. Goueguel
Wilcox, R., (1997). Introduction to Robust Estimation and Hypothesis Testing. Academic Press
# Example 1: Compute biweight midcovariance for two vectors
x <- c(1, 2, 3, 4, 5)
y <- c(2, 3, 4, 5, 6)
stats::cov(x, y)
biweight_midcovariance(x, y)
# Example 2: Biweight midcovariance is robust to outliers
x <- c(1, 2, 3, 4, 100) # An outlier at 100
y <- c(2, 3, 4, 5, 6)
stats::cov(x, y)
biweight_midcovariance(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.