John,

> You can encapsulate mode, median and mean in a single formula.  Suppose y is
> a data vector and t is a scalar.  The a value of t which minimizes
> +/ (|y-t)^i [with special meaning for x^0: see below] is
> - A mode of y if i=0.
> -A median of y if i=1.
> -The mean of y if i=2.

Neat! With a little calculus we can show that such a t satisfies
( (t>y) =&(+/@(#&(|y-t) ^ i-1:)) t<y ). So t is a "higher-order average" of
sorts. This feels connected to distribution moments, but I don't immediately
see the precise relationship.

Thanks for sharing.

> Here x^0 meas 1 if x=0 and 0 if x is nonzero.

Hrm, I believe we want this the other way around.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to