Computes the first derivative (psi function) of robust loss functions,
evaluated at the given residuals. Used internally by ee_mean_robust() and
ee_robust_regression().
This function mirrors robust_loss_functions() in Python delicatessen, so
code translated from Python can keep its shape. There is no base R equivalent
for these score functions, so this is the interface for them in deli as well.
Examples
r <- c(-5, -1, 0, 1, 5)
robust_loss_functions(r, "huber", k = 1.345)
#> [1] -1.345 -1.000 0.000 1.000 1.345
robust_loss_functions(r, "tukey", k = 4.685)
#> [1] 0.0000000 -0.9109563 0.0000000 0.9109563 0.0000000