This function computes the psi_vec needed by the algorithm.

RSAVS_Get_Psi(y_vec, l_type = "L1", l_param = NULL)

Arguments

y_vec

numeric vector

l_type

character string, type of loss function.

  • "L1": l-1 loss(absolute value loss)

  • "L2": l-2 loss(squared error loss)

  • "Huber": Huber loss. Its parameter is given in l_param.

Default value is "L1".

l_param

numeric vector containing necessary parameters of the corresponding loss function. The default value is NULL.

Value

the psi_vec

Details

In the algorithm, when all \(\mu\) are shrinked to the same value, we have $$ \mu_0 = \mathrm{argmin}_{\mu} \sum_i\rho(y_i - \mu) $$ and $$ psi\_vec = (\psi(y_1 - \mu_0), \cdots, \psi(y_n - \mu_0)) $$ where \(\psi = \partial \rho\).

Note

there is a SIGN different between this psi_vec and \(\partial \rho\) w.r.t \(\mu\)

for non-differential loss like L1 at 0, the derivative at 0+ is returned.