With malice aforethought, dither adds a specified random perturbation to each element
of the input vector, usually employed as a device to mitigate the effect of ties.
Usage
dither(x, type = "symmetric", value = NULL)
Arguments
x
x a numeric vector
type
type is either 'symmetric' or 'right'
value
value scale of dequantization
Value
A dithered version of the input vector 'x'.
Details
The function dither operates slightly differently than the function
jitter in base R, permitting strictly positive perturbations with
the option type = "right" and using somewhat different default schemes
for the scale of the perturbation. Dithering the response variable is
frequently a useful option in quantile regression fitting to avoid deleterious
effects of degenerate solutions. See, e.g. Machado and Santos Silva (2005).
For a general introduction and some etymology see the Wikipedia article on "dither".
For integer data it is usually advisable to use value = 1.
When 'x' is a matrix or array dither treats all elements as a vector but returns
an object of the original class.
References
Machado, J.A.F. and Santos Silva, J.M.C. (2005), Quantiles for Counts, Journal of the American Statistical Association, vol. 100, no. 472, pp. 1226-1237.