Adding Support for Other ψ-Functions

Tobias Schoch

1 Introduction

The robsurvey package implements the Huber and Tukey (biweight) ψ-functions. The functions are implemented in the C language, see src/psifunctions.c. For the Huber ψ-function, the standard function and an asymmetric ψ-function are implemented.

The functions are referenced by an integer value (in the C and R source code):

For each type of ψ-function, the following three functions (in the C language) must be defined:

The ψ-, w-, and ψ-functions have the same signature, which is shown here for a dummy function foo().

Argument x is the function argument and argument k is the robustness tuning constant.

Limitations. In this note, we consider only adding support for ψ-functions whose signature comply with the above dummy function. If you want to add functions that do not comply, you have to modify the existing code.

The method dispatch takes place in the functions (see src/psifunctions.c):

and is implemented with function pointers.

2 Adding another function

In order to add support for additional ψ-functions (which comply with the above signature), follow these steps: