# HUrho

HUrho computes rho function for Huber

## Syntax

• rhoHU=HUrho(u,c)example

## Description

 rhoHU =HUrho(u, c) Plot Huber rho function.

## Examples

expand all

### Plot Huber rho function.

close all
x=-3:0.001:3;
c=1.345;
rhoHU=HUrho(x,c);
plot(x,rhoHU,'LineStyle','-','LineWidth',2)
xlabel('$u$','Interpreter','Latex')
ylabel('$\rho (u,1.345)$','Interpreter','Latex')
text(-c,0,'-c=-1.345')
text(c,0,'c=1.345')
hold('on')
plot(x,x.^2/2,'LineStyle',':','LineWidth',1.5)
stem(c,c^2/2)
stem(-c,c^2/2)

## Related Examples

expand all

### Huber rhos function for two values of c.

x=-6:0.01:6;
c=1.345;
rhoHU=HUrho(x,c);
plot(x,rhoHU)
xlabel('u','Interpreter','Latex')
ylabel('$\rho (x,1.345)$','Interpreter','Latex')
text(-c,0,'-c')
text(c,0,'c')
title('$\rho (u,c)$ with $c=1,345$ and $c=2$','Interpreter','Latex')
hold('on')
rhoHU=HUrho(x,2);
plot(x,rhoHU,'-.')

## Input Arguments

### u — scaled residuals or Mahalanobis distances. Vector.

n x 1 vector containing residuals or Mahalanobis distances for the n units of the sample

Data Types: single| double

### c — tuning parameter. Scalar.

Scalar greater than 0 which controls the robustness/efficiency of the estimator (beta in regression or mu in the location case ...)

Data Types: single| double

## Output Arguments

### rhoHU —Huber rho associated to the residuals or Mahalanobis distances for the n units of the sample. n -by- 1 vector

function HUrho transforms vector u as follows $HUrho(u)= \left\{ \begin{array}{cc} (u^2/2) & |u/c| \leq 1 \\ c|u| -c^2/2 & |u/c| >1 \\ \end{array} \right.$

See equation (2.27) p. 26 of Maronna et al. (2006).

Remark: equation (2.26) is written in standardized terms in such a way that $\rho(c)=1$, so it is the previous expression multiplied by $2$

## References

Maronna, R.A., Martin D. and Yohai V.J. (2006), "Robust Statistics, Theory and Methods", Wiley, New York.

Riani, M., Cerioli, A. and Torti, F. (2014), On consistency factors and efficiency of robust S-estimators, "TEST", Vol. 23, pp. 356-387.