Formula: rho(r) = c^2(1 - cos(r/c)), psi(r) = c sin(r/c) for |r| <= c pi, and 0 otherwise
References
Andrews, Bickel, Hampel, Huber, Rogers and Tukey (1972), Robust Estimates of Location, Princeton University Press; Andrews (1974), Technometrics 16:523-531. Not held locally; the form and the tuning constant 1.339 are as implemented by statsmodels' AndrewWave norm, the reference implementation, whose source was read: rho = a^2(1 - cos(z/a)), psi = a sin(z/a), weights = sin(z/a)/(z/a), psi_deriv = cos(z/a), all zero (rho constant) beyond |z| > a pi.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Andrewspsi(V)
#> $psi
#> [1] 0.9096000 1.3350176 1.0498019 0.2057739 0.0000000 0.0000000 0.0000000
#> [8] 0.0000000
#>
#> $rho
#> [1] 0.4771882 1.6547444 2.9058524 3.5645441 3.5858420 3.5858420 3.5858420
#> [8] 3.5858420
#>
#> $psi_deriv
#> [1] 0.73384871 0.07706785 -0.62073642 -0.98812109 0.00000000 0.00000000
#> [7] 0.00000000 0.00000000
#>
#> $rejected
#> [1] 4
#>
#> $c
#> [1] 1.339
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Andrews sine psi"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
