Hi,
we still have the dangling issue of a possible "mode" function for
inclusion in the 'extra' package.
Here's the latest suggestion from the stack-replacement thread (another
issue):
function matrix mode(matrix v)
# v should be a vector
E = ecdf(vec(v))
howmuch = diff(0 | E[,2])[2:] # make sure the 1st is also diffed
where = imaxc(howmuch)
return E[where, 1] | howmuch[where]
end function
It was noted that this is not optimal for multi-modal input, but "what
should be done is debatable". And I mentioned that "this is partly
inherited from the imax*/imin* suite of gretl functions", which also
return _something_ when in fact it is ambiguous.
My proposal is to simply document that the function only returns one
mode, not all (if several exist). But I'm happy to hear improvements.
thanks,
sven
Show replies by date