ASrho

ASrho computes rho function for Andrew's sine function

Syntax

• rhoAS=ASrho(u,c)example

Description

 rhoAS =ASrho(u, c) Plot of rho function.

Examples

expand all

Plot of rho function.

close all
x=-7:0.01:7;
c=2;
rhoAS=ASrho(x,c);
plot(x,rhoAS,'LineWidth',2)
xlabel('$u$','Interpreter','Latex')
ylabel('$\rho (u,2)$','Interpreter','Latex')
text(-c*pi-1,2*c-0.1,'2*c')
text(+c*pi+0.5,2*c-0.1,'2*c')
title('$\rho (u,c)$','Interpreter','Latex')
hold('on')
stem(c*pi,2*c,'LineStyle',':','LineWidth',1)
stem(-c*pi,2*c,'LineStyle',':','LineWidth',1)
text(c*pi-0.8,0.1,'c \pi')
text(-c*pi+0.2,0.1,'-c \pi')

Related Examples

expand all

Compare two rho functions for 2 different values of c.

In the first we fix the bdp (value of efficiency is automatically given), while in the second we find the efficiency (the value of bdp is automatically given)

close all
x=-6:0.01:6;
lwd=2;
hold('on')
c=ASbdp(0.5,1);
rhoAS=ASrho(x,c);
rhoAS=rhoAS/max(rhoAS);
plot(x,rhoAS,'LineStyle','-','LineWidth',lwd)
c=ASeff(0.95,1);
rhoAS=ASrho(x,c);
rhoAS=rhoAS/max(rhoAS);
plot(x,rhoAS,'LineStyle','-.','LineWidth',lwd)
xlabel('$x$','Interpreter','Latex','FontSize',16)
ylabel('AS. Normalized $\rho_c(x)$','Interpreter','Latex','FontSize',20)
legend({'$c_{(bdp=0.5 \mapsto eff=0.2856)}$', '$c_{(eff=0.95 \mapsto bdp= 0.1217)}$'},'Interpreter','Latex','Location','SouthEast','FontSize',16)

Input Arguments

u — scaled residuals or Mahalanobis distances. Vector.

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

rhoAS —Andrew's sine function rho associated to the residuals or Mahalanobis distances for the n units of the sample. vector of length n

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