# OPTwei

OPTwei computes weight function psi(u)/u for optimal weight function

## Syntax

• w=OPTwei(u,c)example

## Description

 w =OPTwei(u, c) Plot of weight function.

## Examples

expand all

### Plot of weight function.

x=-6:0.1:6;
weiOPT=OPTwei(x,2);
plot(x,weiOPT)
xlabel('x','Interpreter','Latex')
ylabel('$W (x) =\psi(x)/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

### c — tuning parameters. 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

### w —Optimal weights associated to the scaled residuals or Mahalanobis distances for the n units of the sample. n -by- 1 vector

Function OPTwei transforms vector u as follows $OPTwei(u,c) = \left\{ \begin{array}{cc} 1/(3.25*c^2) & |u| \leq 2 \\ (1/3.25) \left( -1.944 * 1 / c^2 + 1.728 \frac{u^2}{c^4} - 0.312\frac{u^2}{c^6} + 0.016 \frac{u.^6}{c^8} \right) & \qquad 2c\leq |u|\leq 3c \\ 0 \end{array} \right.$
Remark: Yohai and Zamar (1997) showed that the optimal $\rho$ function is optimal in the following highly desirable sense: the final M estimate has a breakdown point of one-half and minimizes the maximum bias under contamination distributions (locally for small fraction of contamination), subject to achieving a desidered nominal asymptotic efficiency when the data are Gaussian.