**Ada**ptive **Huber** Estimation and Regression

This package implements the Huber-type estimator for mean, covariance matrix, regression and *l _{1}*-regularized Huber regression (Huber-Lasso). For all these methods, the robustification parameter

Specifically, for Huber regression, assume the observed data vectors (*Y*, *X*) follow a linear model *Y = θ _{0} + X θ + ε*, where

**2022-03-04**

Version 1.1 is submitted to CRAN.

Install `adaHuber`

from CRAN

Error: Compilation failed (with messages involving lgfortran, clang, etc.).

**Solution**: This is a compilation error of Rcpp-based source packages. It happens when we recently submit a new version to CRAN, but it usually takes 3-5 days to build the binary package. Please use an older version or patiently wait for 3-5 days and then install the updated version.Error: unable to load shared object.. Symbol not found: _EXTPTR_PTR.

**Solution**: This issue is common in some specific versions of`R`

when we load Rcpp-based libraries. It is an error in R caused by a minor change about`EXTPTR_PTR`

. Upgrading R to 4.0.2 will solve the problem.

There are five functions in this package:

`adaHuber.mean`

: Adaptive Huber mean estimation.`adaHuber.cov`

: Adaptive Huber covariance estimation.`adaHuber.reg`

: Adaptive Huber regression.`adaHuber.lasso`

: Adaptive Huber-Lasso regression.`adaHuber.cv.lasso`

: Cross-validated adaptive Huber-Lasso regression.

Help on the functions can be accessed by typing `?`

, followed by function name at the R command prompt.

For example, `?adaHuber.reg`

will present a detailed documentation with inputs, outputs and examples of the function `adaHuber.reg`

.

First, we present an example of Huber mean estimation. We generate data from a *t* distribution, which is heavy-tailed. We estimate its mean by the tuning-free Huber mean estimator.

Then we present an example of Huber covariance matrix estimation. We generate data from *t* distribution with df = 3, which is heavy-tailed.

Next, we present an example of adaptive Huber regression. Here we generate data from a linear model *Y = X θ + ε*, where *ε* follows a *t* distribution, and estimate the intercept and coefficients by tuning-free Huber regression.

```
n = 200
p = 10
beta = rep(1.5, p + 1)
X = matrix(rnorm(n * p), n, p)
err = rt(n, 2)
Y = cbind(1, X) %*% beta + err
fit.adahuber = adaHuber.reg(X, Y, method = "adaptive")
beta.adahuber = fit.adahuber$coef
```

Finally, we illustrate the use of *l _{1}*-regularized Huber regression. Again, we generate data from a linear model

```
n = 100; p = 200; s = 5
beta = c(rep(1.5, s + 1), rep(0, p - s))
X = matrix(rnorm(n * p), n, p)
err = rt(n, 2)
Y = cbind(rep(1, n), X) %*% beta + err
fit.lasso = adaHuber.cv.lasso(X, Y)
beta.lasso = fit.lasso$coef
```

GPL-3.0

C++11

Xiaoou Pan xip024@ucsd.edu, Wen-Xin Zhou wez243@ucsd.edu

Xiaoou Pan xip024@ucsd.edu

Eddelbuettel, D. and Francois, R. (2011). Rcpp: Seamless R and C++ integration. *J. Stat. Softw.* **40** 1-18. Paper

Fan, J., Liu, H., Sun, Q. and Zhang, T. (2018). I-LAMM for sparse learning: Simultaneous control of algorithmic complexity and statistical error. *Ann. Statist.* **46** 814–841. Paper

Ke, Y., Minsker, S., Ren, Z., Sun, Q. and Zhou, W.-X. (2019). User-friendly covariance estimation for heavy-tailed distributions. *Statis. Sci.* **34** 454-471. Paper

Pan, X., Sun, Q. and Zhou, W.-X. (2021). Iteratively reweighted l1-penalized robust regression. *Electron. J. Stat.* **15** 3287-3348. Paper

Sun, Q., Zhou, W.-X. and Fan, J. (2020). Adaptive Huber regression. *J. Amer. Stat. Assoc.* **115** 254-265. Paper

Wang, L., Zheng, C., Zhou, W. and Zhou, W.-X. (2021). A new principle for tuning-free Huber regression. *Stat. Sinica* **31** 2153-2177. Paper