HApsi

HApsi computes psi function using Hampel proposal

Syntax

Description

example

psiHA =HApsi(u, ctuning) Plot of psi function.

Examples

expand all

  • Plot of psi function.
  • % Plot of psi function.
    % Obtain bottom panel of Figure 11.10 p. 375 of
    % Hoaglin et al. (1987).
    close all
    x=-9:0.1:9;
    psiHA=HApsi(x,1);
    plot(x,psiHA,'LineWidth',2)
    xlabel('$u$','Interpreter','Latex','FontSize',14)
    ylabel(' Hampel $\psi(u,[2,4,8]) $','Interpreter','Latex')
    a=2;
    b=4;
    c=8;
    hold('on')
    stem(a,a,'LineWidth',1,'LineStyle',':')
    stem(b,a,'LineWidth',1,'LineStyle',':')
    stem(-a,-a,'LineWidth',1,'LineStyle',':')
    stem(-b,-a,'LineWidth',1,'LineStyle',':')
    ax=axis;
    ylim([ax(3)-0.1 ax(4)+0.1])
    text([a;-a],[-0.1;0.1],{'$a$';'$-a$'},'Interpreter','latex','FontSize',14)
    text([b;-b],[-0.1;0.1],{'$b$';'$-b$'},'Interpreter','latex','FontSize',14)
    text([c;-c],[-0.1;0.1],{'$c$';'$-c$'},'Interpreter','latex','FontSize',14)

    Input Arguments

    expand all

    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

    ctuning — tuning parameters. Scalar or Vector.

    Scalar or vector of length 4 which specifies the value of the tuning constant c (scalar greater than 0 which controls the robustness/efficiency of the estimator) and the prefixed values of paramters a, b, c ctuning(1) = tuning constant which will multiply parameters a, b and c of Hampel rho (psi) function ctuning(2) = paramter a of Hampel rho (psi) function ctuning(3) = paramter b of Hampel rho (psi) function ctuning(4) = paramter c of Hampel rho (psi) function Remark: if length(ctuning)==1 values of a, b and c will be set to a=2*ctuning b=4*ctuning c=4*ctuning With these choices, if ctuning=1 the resulting influence function is nearly identical to the biweight with parameter 8.

    Data Types: single| double

    More About

    expand all

    Additional Details

    Function HApsi transforms vector u as follows.

    \[ HApsi(u) = \left\{ \begin{array}{cc} u & |u| \leq a \\ a \times \mbox{sign} (u) & a \leq |u| < b \\ a \frac{c-|u|}{c-b} \times \mbox{sign} (u) & b \leq |u| < c \\ 0 & |u| >= c \end{array} \right. \]

    where $a$= ctun *ctuning(2).

    $b$= ctun *ctuning(3).

    $c$= ctun *ctuning(4).

    The default is $a$= 2*ctun.

    $b$= 4*ctun.

    $c$= 8*ctun.

    It is necessary to have 0 <= a <= b <= c

    References

    Hoaglin, D.C., Mosteller, F., Tukey, J.W. (1982), "Understanding Robust and Exploratory Data Analysis", Wiley, New York.

    See Also

    | |

    This page has been automatically generated by our routine publishFS