# HYPeff

HYPeff finds constant c which is associated to the requested efficiency for hyperbolic estimator

## Syntax

• c=HYPeff(eff, v)example
• c=HYPeff(eff, v, k)example
• c=HYPeff(eff, v, k, traceiter)example
• [c,A]=HYPeff(___)example
• [c,A,B]=HYPeff(___)example
• [c,A,B,d]=HYPeff(___)example

## Description

 c =HYPeff(eff, v) Find parameter c for fixed efficiency.

 c =HYPeff(eff, v, k) Example of specifying k.

 c =HYPeff(eff, v, k, traceiter) Find parameters for fixed efficiency and k.

 [c, A] =HYPeff(___) Example of use of option Find parameters for fixed efficiency and k.

 [c, A, B] =HYPeff(___) Example to show the issue of multiple solutions problem.

 [c, A, B, d] =HYPeff(___) Compare the weight function for 6 different links.

## Examples

expand all

### Find parameter c for fixed efficiency.

Find value of c for a nominal efficiency of 0.9 when k=4.5 (default value).

c=HYPeff(0.9,1);
% In this case
% c = 3.3139

### Example of specifying k.

Find value of c for a nominal efficiency of 0.9 when k=4

ktuning=4;
c=HYPeff(0.9,1,ktuning);
% In this case
% c =  3.5443

### Find parameters for fixed efficiency and k.

Find value of c, A, B, for a nominal efficiency of 0.8427 when k=4.5

ktuning=4.5;
[c,A,B,d]=HYPeff(0.8427,1,ktuning);
% In this case
% c = 3.000130564905703
% A = 0.604298601602487
% B = 0.713612241773758
% d= 1.304379168746527
% See also Table 2 of HRR p. 645

### Example of use of option Find parameters for fixed efficiency and k.

Find value of c, A, B, for a nominal efficiency of 0.8427 when k=4.5

ktuning=4.5;
traceiter =true;
[c,A,B,d]=HYPeff(0.8427,1,ktuning,traceiter);
% In this case
% c = 3.000130564905703
% A = 0.604298601602487
% B = 0.713612241773758
% d= 1.304379168746527
% See also Table 2 of HRR p. 645

### Example to show the issue of multiple solutions problem.

5 redescending psi functions are used and the Huber psi.

load Income1;
y=Income1{:,"HTOTVAL"};
% Use contaminated income data
y=[y(1:20); 600000; 575000; 590000];
y=y';
eff=0.95;
TBc=TBeff(eff,1);
HUc=HUeff(eff,1);
HAc=HAeff(eff,1);
HYPc=HYPeff(eff,1);
OPTc=OPTeff(eff,1);
PDc=PDeff(eff);
mu=0:1000:700000;
avePSI=zeros(length(mu),6);
for i=1:length(mu)
end
% Plotting part
close
Link={'Huber', 'Hampel', 'Tukey', 'Hyperbolic' 'Optimal' 'Power divergence'} ;
for i=1:6
subplot(2,3,i)
plot(mu',avePSI(:,i),'LineWidth',2,'Color','k')
hold('on')
yline(0) %  line([min(mu);max(mu)],[0;0],'LineStyle',':')
xlabel('$\mu$','FontSize',14,'Interpreter','Latex')
ylabel('$\overline \psi \left( \frac{ y -\mu}{\hat \sigma} \right)$','FontSize',14,'Interpreter','Latex')
end

### Compare the weight function for 6 different links.

FontSize=14;
FontSizetitl=12;
x=-6:0.01:6;
ylim1=-0.05;
ylim2=1.05;
xlim1=min(x);
xlim2=max(x);
LineWidth=2;
subplot(2,3,1)
ceff05HU=HUeff(0.95,1);
weiHU=HUwei(x,ceff05HU);
plot(x,weiHU,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Huber','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])
subplot(2,3,2)
ceff095HA=HAeff(0.95,1);
weiHA=HAwei(x,ceff095HA);
plot(x,weiHA,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Hampel','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])
subplot(2,3,3)
ceff095TB=TBeff(0.95,1);
weiTB=TBwei(x,ceff095TB);
plot(x,weiTB,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Tukey biweight','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])
subplot(2,3,4)
ceff095HYP=HYPeff(0.95,1);
ktuning=4.5;
weiHYP=HYPwei(x,[ceff095HYP,ktuning]);
plot(x,weiHYP,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Hyperbolic','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])
subplot(2,3,5)
ceff095OPT=OPTeff(0.95,1);
% ceff095OPT=ceff095OPT/3;
weiOPT=OPTwei(x,ceff095OPT);
weiOPT=weiOPT/max(weiOPT);
plot(x,weiOPT,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Optimal','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])
subplot(2,3,6)
ceff095PD=PDeff(0.95);
weiPD=PDwei(x,ceff095PD);
weiPD=weiPD/max(weiPD);
plot(x,weiPD,'LineWidth',LineWidth)
xlabel('$u$','Interpreter','Latex','FontSize',FontSize)
title('Power divergence','FontSize',FontSizetitl)
ylim([ylim1 ylim2])
xlim([xlim1 xlim2])

## Input Arguments

### eff — efficiency. Scalar.

Scalar which contains the required efficiency (of location or scale estimator).

Generally eff=0.85, 0.9 or 0.95

Data Types: single| double

### v — number of response variables. Scalar.

Number of variables of the dataset (for regression v=1) UP TO NOW v=1 (JUST REGRESSION) TO DO FOR MULTIVARIATE ANALYSIS

Data Types: single| double

### k — supremum of the change of variance curve. Scalar.

$\sup CVC(psi,x) x \in R$ Default value is k=4.5.

Example: 5 

Data Types: double

### traceiter — Level of display. Scalar.

If traceiter = 1 it is possible to monitor how the value of the objective function B^2/A gets closer to the target (eff) during the iterations

Example: 'traceiter',0 

Data Types: double

## Output Arguments

### c —parameter c of hyperbolic tangent estimator. Scalar

For more details see the methodological details inside "More About" below

### A —parameter A of hyperbolic tangent estimator. Scalar

For more details see the methodological details inside "More About" below

### B —parameter B of hyperbolic tangent estimator. Scalar

For more details see the methodological details inside "More About" below

### d —parameter d of hyperbolic tangent estimator. Scalar

For more details see the methodological details inside "More About" below

$HYPpsi(u) = \left\{ \begin{array}{cc} u & |u| \leq d \\ \sqrt{A (k - 1)} \tanh \left( \sqrt{(k - 1) B^2/A} (c -|u|)/2 \right) sign(u) & d \leq |u| < c, \\ 0 & |u| \geq c. \end{array} \right.$ It is necessary to have $0 < A < B < 2 normcdf(c)-1- 2 c \times normpdf(c) <1$