# RKpsix

RKpsix computes psi function times x for Rocke (translated Tukey's) biweight

## Syntax

• psixRK=RKpsix(u,c, M)example

## Description

 psixRK =RKpsix(u, c, M) Plot of x psi(x) function.

## Examples

expand all

### Plot of x psi(x) function.

close all
% Find the values of c and M given bdp=0.4 and v=5 for ARP=0.01
x=0:0.01:5;
bdp=0.4;
v=5;
ARP=0.01;
[c,M]=RKbdp(bdp,v,ARP);
psixRK=RKpsix(x,c,M);
% psixRK=psixRK/max(psiRK);
plot(x,psixRK,'LineWidth',2)
xlabel('$u$','Interpreter','Latex')
ylabel('$u\psi (u,c,M)$','Interpreter','Latex')
title('$u \psi (u,c,M)$','Interpreter','Latex')
hold('on')
stem(M,M^2,'LineStyle',':','LineWidth',1)
text(M,0,'M')
stem(M+c,0,'LineStyle',':','LineWidth',1)
text(M+c,0,'M+c')

## Related Examples

expand all

### Compare Rocke psix functions for 3 different values of bdp.

close all
x=0:0.01:6;
% Number of variables v is fixed to 5
v=5;
% ARP is fixed to 0.01
ARP=0.01;
lwd=2;
hold('on')
% Use bdp=0.3
bdp=0.3;
[c,M]=RKbdp(bdp,v,ARP);
psixRK030=RKpsix(x,c,M);
psixRK030=psixRK030/max(psixRK030);
plot(x,psixRK030,'LineStyle','-','LineWidth',lwd)
% Use bdp=0.4
bdp=0.4;
[c,M]=RKbdp(bdp,v,ARP);
psixRK040=RKpsix(x,c,M);
psixRK040=psixRK040/max(psixRK040);
plot(x,psixRK040,'LineStyle','-.','LineWidth',lwd)
% Use bdp=0.5
bdp=0.5;
[c,M]=RKbdp(bdp,v,ARP);
psixRK050=RKpsix(x,c,M);
psixRK050=psixRK050/max(psixRK050);
plot(x,psixRK050,'LineStyle','--','LineWidth',lwd)
xlabel('$x$','Interpreter','Latex','FontSize',16)
ylabel('RK. Normalized $x \psi(x,c,M)$','Interpreter','Latex','FontSize',20)
legend({'$bdp=0.3$', '$bdp=0.4$' '$bdp=0.5$'},'Interpreter','Latex','Location','SouthEast','FontSize',16)

## 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 parameter. Scalar.

Non negative scalar which (together with the other optional parameter M) controls the robustness/efficiency of the estimator (beta in regression or mu in the location case ...).

Data Types: single| double

### M — tuning parameter. Scalar.

Scalar greater than 0 which (together with the other optional parameter c) controls the robustness/efficiency of the estimator (beta in regression or mu in the location case ...).

Data Types: single| double

## Output Arguments

### psixRK —Rocke psi (translated Tukey's biweight) associated to the residuals or Mahalanobis distances for the n units of the sample. n -by- 1 vector

function RKpsix transforms vector u as follows $RKpsix(u)= \left\{ \begin{array}{cc} u^2 & 0\leq u \leq M \\ u^2 \left(1-\left( \frac{u-M}{c} \right)^2 \right)^2 & M < u \leq M+c \\ 0 & u > M+c \\ \end{array} \right.$