| Title: | Robust Statistical Methods with Huber Estimators |
| Version: | 0.1.0 |
| Author: | Nair Gonzalez Sotomayor [aut, cre], Aquiles Enrique Darghan Contreras [aut] |
| Maintainer: | Nair Gonzalez Sotomayor <njgonzalezs@unal.edu.co> |
| Description: | Provides robust statistical methods for analyzing numeric data, including robust estimation of location and scale using Huber M-estimators and a robust two-sample t-test. Methods are based on Huber (1981, ISBN:0471418056) "Robust Statistics" and Smyth (2004) <doi:10.2202/1544-6115.1027>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Imports: | limma, stats |
| NeedsCompilation: | no |
| Packaged: | 2026-05-30 17:09:41 UTC; root |
| Repository: | CRAN |
| Date/Publication: | 2026-06-03 14:10:07 UTC |
Huber M-estimator for location and scale
Description
Computes robust estimates of mean (mu) and scale (sigma)
using Huber's M-estimator.
Usage
huber_estimation(x, c = 1.345, tol = 1e-06, max_iter = 100)
Arguments
x |
Numeric vector of observations. |
c |
Tuning constant (default 1.345). Larger values make the estimator closer to the mean, smaller values make it more robust. |
tol |
Convergence tolerance (default 1e-6). |
max_iter |
Maximum number of iterations (default 100). |
Value
A list with two elements:
- mu
Estimated robust mean
- sigma
Estimated robust scale (standard deviation)
Examples
set.seed(123)
x <- c(rnorm(100), 10) # outlier at 10
huber_estimation(x)
Robust Huber-Moderated t-Test for Gene Expression
Description
Performs a moderated two-sample t-test on count data using Huber M-estimators and empirical Bayes variance shrinkage (via limma::squeezeVar).
Usage
robust_huber_moderated(counts, group, c_huber = 1.345, robust_prior = TRUE)
Arguments
counts |
Numeric matrix of counts (genes in rows, samples in columns). |
group |
Factor indicating group membership for each column/sample. |
c_huber |
Tuning constant for Huber estimator (default 1.345). |
robust_prior |
Logical; if TRUE, uses a robust empirical Bayes prior (default TRUE). |
Value
Numeric vector of p-values, one per gene.
Examples
library(limma)
counts <- matrix(rpois(200, lambda = 10), nrow = 20)
group <- factor(rep(c("A", "B"), each = 5))
pvals <- robust_huber_moderated(counts, group)
Two-Sample Robust t-Test (Huber)
Description
Performs a robust two-sample t-test using Huber M-estimators for location and scale.
Usage
robust_t_test(x, y, c = 1.345)
Arguments
x |
Numeric vector of sample 1. |
y |
Numeric vector of sample 2. |
c |
Tuning constant for Huber estimator (default 1.345). |
Value
An object of class "htest" similar to t.test.
Examples
set.seed(123)
x <- rnorm(30, mean = 5)
y <- rnorm(35, mean = 6)
robust_t_test(x, y)