Determines the index of the minimum or maximum of a vector.
If there are multiple entries which achieve the minimum or maximum,
one of the indices is selected at random.
Usage
which.min.fair(x)
which.max.fair(x)
Value
A single integer (or integer(0) if all entries of x are
These functions are alternatives to
the standard R functions which.min
and which.max.
The standard functions which.min
and which.max find the index of the
first entry in the vector x which achieves the minimum
or maximum value. This can cause a bias in some simulation
experiments.
The functions which.min.fair and which.max.fair
identify all entries of the vector x which achieve the
minimum or maximum respectively, and
select one of them at random.