calchubermeandif: The difference between Huber's M-estimator of location

View source: R/calchubermeandif.R

calchubermeandifR Documentation

The difference between Huber's M-estimator of location

Description

Computes the difference between Huber's M-estimator of location of two groups in long data format.

Usage

calchubermeandif(x, indices, ...)

Arguments

x

A data frame or matrix containing the input data. The first column should be the variable of interest, and the second column should be the grouping variable.

indices

Optional; specific rows to be considered. If not provided, all rows are used.

...

Additional arguments passed to the internal hubermean function.

Details

This function demonstrates the structure of a user-defined statistic function to use with bootstrap and permutation test. The function calculates the difference between Huber's M-estimator of location of two groups using the iterative weighted mean method. Huber's M-estimator of location is robust to outliers and is computed using an iterative re-weighting procedure. The internal function follows:

  • Initialize with the median of the data.

  • Compute weights based on deviations from the current mean.

  • Update the mean iteratively until convergence is reached.

Value

A numeric value representing the difference between Huber's M-estimator of location of the two groups.

Author(s)

Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe

See Also

median

Examples

df <- data.frame(value = rnorm(100), group = rep(1:2, each = 50))
bivarplot(df)

# Bootstrap confidence intervals for the difference of 
# Huber's M-estimator of location of two groups
# Increase R for real-world applications
bshubermean <- bootstrap(df, statistic=calchubermeandif, alpha=0.05,
   alternative="less", R=200)
bshubermean

groupcompare documentation built on June 26, 2025, 1:08 a.m.