| Title: | Robust Statistical Methods with Huber Estimators |
|---|---|
| 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>. |
| Authors: | Nair Gonzalez Sotomayor [aut, cre], Aquiles Enrique Darghan Contreras [aut] |
| Maintainer: | Nair Gonzalez Sotomayor <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-03 18:34:22 UTC |
| Source: | https://github.com/cran/robusttseq |
Computes robust estimates of mean (mu) and scale (sigma)
using Huber's M-estimator.
huber_estimation(x, c = 1.345, tol = 1e-06, max_iter = 100)huber_estimation(x, c = 1.345, tol = 1e-06, max_iter = 100)
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). |
A list with two elements:
Estimated robust mean
Estimated robust scale (standard deviation)
set.seed(123) x <- c(rnorm(100), 10) # outlier at 10 huber_estimation(x)set.seed(123) x <- c(rnorm(100), 10) # outlier at 10 huber_estimation(x)
Performs a moderated two-sample t-test on count data using Huber M-estimators and empirical Bayes variance shrinkage (via limma::squeezeVar).
robust_huber_moderated(counts, group, c_huber = 1.345, robust_prior = TRUE)robust_huber_moderated(counts, group, c_huber = 1.345, robust_prior = TRUE)
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). |
Numeric vector of p-values, one per gene.
library(limma) counts <- matrix(rpois(200, lambda = 10), nrow = 20) group <- factor(rep(c("A", "B"), each = 5)) pvals <- robust_huber_moderated(counts, group)library(limma) counts <- matrix(rpois(200, lambda = 10), nrow = 20) group <- factor(rep(c("A", "B"), each = 5)) pvals <- robust_huber_moderated(counts, group)
Performs a robust two-sample t-test using Huber M-estimators for location and scale.
robust_t_test(x, y, c = 1.345)robust_t_test(x, y, c = 1.345)
x |
Numeric vector of sample 1. |
y |
Numeric vector of sample 2. |
c |
Tuning constant for Huber estimator (default 1.345). |
An object of class "htest" similar to t.test.
set.seed(123) x <- rnorm(30, mean = 5) y <- rnorm(35, mean = 6) robust_t_test(x, y)set.seed(123) x <- rnorm(30, mean = 5) y <- rnorm(35, mean = 6) robust_t_test(x, y)