biweight_midcovariance: Biweight Midcovariance

View source: R/biweight_midcovariance.R

biweight_midcovarianceR Documentation

Biweight Midcovariance

Description

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.

Usage

biweight_midcovariance(x, y)

Arguments

x

A numeric vector.

y

A numeric vector of the same length as x.

Value

The biweight midcovariance between x and y.

Author(s)

Christian L. Goueguel

References

  • Wilcox, R., (1997). Introduction to Robust Estimation and Hypothesis Testing. Academic Press

Examples

# 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)


ChristianGoueguel/specProc documentation built on Nov. 9, 2024, 3:23 p.m.