Means

This is basic statistics, but it's stuff every mathematician should know.
Further, it's related to calculus: it gives applications and insight.

BTW, where did the geometric mean come from?
The only place I've seen it in geometry is in the volume of the
frustum.

BTW, the geometric mean is also the arithmetic-harmonic mean:
if you start with two numbers and repeatedly take their arithmetic and
harmonic means (respectively), this converges to the geometric mean.
[you can define arithmetic-geometric and geometric-harmonic means,
 which are different.]

Given a map $f\from X \to \bR$ (where $X \subset \bR$),
think of $x \in X$ as your (invisible) data points,
  (distributed with some probability, so $X$ should be
   a probability space)
and $f(x)$ your observed quantities.
There's some point $x^* \in X$ which is the ``right point'',
  (that's why we give it a star ;-)
and let's say it's the expected value of $X$, so $x^* = E(X)$.

We want to estimate $f(x^*)$, given a collection of $f(x_i)$s.
If we knew the $x_i$s, we could just average them, then apply $f$, and
we'd get a good answer -- but we don't: we only know the $f(x_i)$s.

By ``estimate'' I mean
``give a function for it that (almost surely) converges in the limit''
Ideally it's also close: the ``best'' guess, given the data.

EGs
You want to calculate the length of a metal rod at room temperature,
but you don't have a thermometer, only a ruler.
(room temp = the ``right point'', expansion means length function of
temp, etc.)

better EG?

-------------------------------------------------------------------------

2 easy cases:
i (linear):  If $f$ is linear (or rather, affine), then we can average the $f(x_i)$s:
   $f(E(X)) = E(f(X))$, by linearity of integral
ii (know function): If we know $f$ -and- it's invertible, we can apply $f^{-1}$,
  average, and then apply $f$.

[Q: what's the general setting for this? I guess it should be
 maps between convex sets: convex sets are where -averages- make
 sense.]

Since differentiable functions are -locally- -approximately- linear,
if the points don't vary too much, the arithmetic mean is an okay
estimate. (The expected error is measured (or at least bounded) by
the second derivative, IE the concavity/curvature.)

However, if the points vary a lot, it's not so good -- if we know
something about the function, we can do better, as suggested above
in ``know function''.

3 common EGs:
(these all make far more sense if $f(x) > 0$, otherwise life is harder)
- exponential
  Often $f' \propto f$, meaning $f(x)=Ca^x$ for some $C,a$;
  in that case we can take $\log$, average, then apply $\exp$.
  Concretely, this is:
  ``multiply the $x_i$ and take the $n$th root''
  and is called the \Def{geometric mean}
- inverse
  often we expect $f$ to vary inversely to $x$, so applying $1/x$
  and such, we get the \Def{harmonic mean}
- $L^p$
  if $f(x)=Cx^{1/p}$, then we can apply $x^p$, average,
  then take $x^{1/p}$;
  this is the $L^p$ mean (though I haven't heard it called that)

IDEA: The (arithmetic) mean is always approximately okay;
  to do better, you need to know (or guess) something about your
  function -- and then use the mean corresponding to that function.
-------------
Inequalities

The key word here is ``Jensen's inequality''.

Since $\exp$ is (strictly) convex up, we get the AM-GM inequality:
$$AM(x_i) \geq GM(x_i)$$
with equality iff all the $x_i$ are equal.

Likewise $AM \geq HM$
  (recall that the $x_i$ are all positive;
  obviously if all negative we'd get the opposite, and if mixture of
  positive and negative we might get undefined)
and $GM \geq HM$
  (need to be a bit careful here with inverses;
   I think it's because $1/\log$ is convex up).
Easiest way to remember these is to just plug in easy numbers like $1,4$.
Note that since $1/x$ is its own inverse, we might think $HM \geq AM$
too, which seems a contradiction. What we actually get is
$1/HM \geq 1/AM$, which is of course good and true -- but be careful
of orientation reversing $f$ (IE, decreasing $f$).

Likewise I think we get the relations between the $L^p$ norms:
on a -probability space-, $p<q \implies \norm{f}_p < \norm{f}_q$,
with equality iff $f$ is essentially constant.
in particular, this gives us the (reverse!) inclusion of $L^p$ spaces:
if $p < q$, then $L^p > L^q$.
(if it's not a probability space, we get a factor of $C^p$ and $C^q$,
 where $C$ is the total volume. If it's not finite volume, then
 everything gets screwed up, and notably
 false: we don't have containment of the different $L^p$ spaces)

-------------
Note that if $f'(x_0)=0$, then it's not locally injective, but in that
case the values should cluster very well.
-------------
Median, mode

Without knowledge of $f$ but with knowledge of the probability
distribution, we can still estimate $f(x_0)$ (so long as it's
monotone).
If we take the median of the $f(x_i)$, that gives us $f$ of the median
(median commutes with monotone functions), and if the median of $X$ is
the mean (EG, if the distribution on $X$ is symmetric, which is very
frequently the case in nature), then this estimates $f(x^*)$.

Similarly, if the mean of $X$ is also the mode (most likely point),
then we can take the mode of $f(x_i)$ -- which only works if $f'$ is
constant (or approximately constant, which it always is locally),
else we mess with modes
-- but here we get into all sorts of problems with histograms,
b/c we can't take the -literal- mode (most frequently occuring value),
as the values in general will all be distinct.
Instead, we need to pick the most frequently hit -interval- (or
region, whatever), and you need to do statistics to determine the
right (or at least ``a good'') interval size.

-------------
what if it's something like $\abs{x}$? (centered about $x^*$)

In that case a good estimate is the -min-.
Here in particular we -know- that we're over-estimating, so
there should be some way of guessing how close to the min we're
getting -- and there is (that is, I'm sure there is, though I don't
know it -- it's a totally natural question).

-------------
Axiomatically, what should a -mean- be?
Some obvious properties should be:
- $S_n$ invariant in the $x_i$
  (more generally, invariant under measure preserving maps)
- on the diagonal, it should be the identity
  (more generally, say that $f(x_1,\dots,x_n,y)$
  should equal $f(x,\dots,x,y)$, where $x$ is the mean of the $x_i$)
...and so forth.
We've just discussed the means that can be represented by functions.
-------------
AGM: arithmetic-geometric-mean
  This is a weird kinda dynamical system:
  given $x,y$, apply AM and GM to get $(AM(x,y),GM(x,y))$,
  and then iterate.
  I have -no- idea what this means, but I think it converges,
  and it's close to what Archimedes did to compute $\pi$.
-------------
deeper statistics:
at this point there's lots of natural questions:
- can we estimate the error?
  (yes, but note that the answer is always
   ``to a certain certainty''
   EG, with 95\% probability, the error is in [interval];
   it's really a 1-parameter family of error intervals)
- how quickly does this converge?
  (just see how quickly the error goes to zero)

...and so forth.
That's for a statistics class.
-------------
BTW, here's an example of where the Harmonic Mean is very appropriate:
suppose there's a school with 2 classes,
1 with 100 students, 1 with 2 students.
Then -there's more students in the bigger class-,
so from the -students- POV, the mean number of students in a class is
~98 (the harmonic mean of 100 and 2),
while from the teachers POV the mean is 51.

The Harmonic mean is appropriate here.
