# HYPrho

HYPrho computes rho function using hyperbolic tangent estimator

## Syntax

• rhoHYP=HYPrho(u, cktuning)example

## Description

 rhoHYP =HYPrho(u, cktuning) Plot of rho function for hyperbolic tangent estimator.

## Examples

expand all

### Plot of rho function for hyperbolic tangent estimator.

% Plot of rho function for hyperbolic tangent estimator.
x=-8:0.001:8;
ctuning=6;
ktuning=4.5;
rhoHYP=HYPrho(x,[ctuning,ktuning]);
plot(x,rhoHYP)
xlabel('x','Interpreter','Latex')
ylabel(' Hyperbolic $\rho(x)$','Interpreter','Latex')

## Related Examples

expand all

### Parameters associated to a value of bdp=1/2.

c=2.158325031399727
k=4;
A=0.000162707412432;
B=0.006991738279441
d=0.016982948780061
x=-8:0.001:8;
rhoHYP=HYPrho(x,[c,k,A,B,d]);
plot(x,rhoHYP)
xlabel('x','Interpreter','Latex')
ylabel(' Hyperbolic $\rho(x)$','Interpreter','Latex')

## 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

### cktuning — tuning parameters. Vector of length 2 or of length 5.

cktuning specifies the value of the tuning constant c (scalar greater than 0 which controls the robustness/efficiency of the estimator) and the prefixed value k (sup of the change-of-variance sensitivity) and the values of parameters A, B and d.

cktuning(1) = c;

cktuning(2) = k = supCVC(psi,x) x \in R;

cktuning(3)=A;

cktuning(4)=B;

cktuning(5)=d;

Remark - if length(cktuning)==2 values of A, B and d will be computed automatically

Data Types: single| double

## Output Arguments

### rhoHYP —rho function for hyperbolic tangent estimator.  Vector

n x 1 vector which contains the hyperbolic rho associated to the residuals or Mahalanobis distances for the n units of the sample.

## More About

### Additional Details

Hampel et al. (1981) have introduced a rho function which minimizes the asymptotic variance of the regression M-estimate, subject to a bound on the supremum of the Change of Variance Curve of the estimate. This leads to the Hyperbolic Tangent $\rho$ function, which, for suitable constants $c$, $k$, $A$, $B$ and $d$, is defined as $HYPrho(u) = \left\{ \begin{array}{cc} u^2/2 & |u| \leq d, \\ d^2/2 -2 \frac{A}{B} \log \left\{ \cosh \left[ 0.5 \sqrt{ \frac{(k - 1) B^2}{A} } (c - |u|) \right] \right\} & \\ +2 \frac{A}{B}\log \left\{ \cosh \left[ 0.5\sqrt{\frac{(k - 1) B^2}{A}}(c -d)\right] \right\} & \\ & d \leq |u| < c, \\ d^2/2 +2 \frac{A}{B} \log \left\{ \cosh \left[ 0.5 \sqrt{ \frac{(k - 1) B^2}{A} }(c -d) \right] \right\} & |u| \geq c. \\ \end{array} \right.$ where $0 < d < c$ is such that $d = \sqrt{[A(k-1)]}\tanh [\frac{1}{2}\sqrt{\frac{(k-1)B^2}{A}}(c - d)],$

$A$ and $B$ satisfy suitable conditions, and $k$ is related to the bound in the Change of Variance Curve.

More precisely, it is necessary to have $0 < A < B < 2 *normcdf(c)-1- 2*c*normpdf(c) <1$

## References

Hampel, F.R., Rousseeuw, P.J. and Ronchetti E. (1981), The Change-of-Variance Curve and Optimal Redescending M-Estimators, "Journal of the American Statistical Association", Vol. 76, pp. 643-648 [HRR]

Riani, M., Cerioli, A., Atkinson, A.C. and Perrotta, D. (2014), Monitoring Robust Regression, "Electronic Journal of Statistics", Vol. 8, pp. 646-677.

## See Also

This page has been automatically generated by our routine publishFS