I am trying to calculate the mean (if it exists) of a half-Cauchy distribution. I know that the mean of the a Cauchy is undefined, but I was wondering whether the same is true of a half-Cauchy? (A half-Cauchy is a Cauchy that is truncated to only have support for positive $X$).
At the moment I have been doing the following:
Mean@TruncatedDistribution[{0, \[Infinity]}, CauchyDistribution[a, b]]
which returns the following (not sure why it involves $i$? Perhaps I need to define $a$ and $b$ to be reals.):
$\frac{i (a \log (-a-i b)+i b \log (-a-i b)-a \log (-a+i b)+i b \log (-a+i b))}{2 \pi \left(\frac{\tan ^{-1}\left(\frac{a}{b}\right)}{\pi }+\frac{1}{2}\right)}$
If I plot the half-Cauchy and its mean, then I get quite an odd result as I increase $b$, whereby the mean actually decreases and becomes negative (even though the distribution only has support on positive $X$):
Manipulate[
Module[{aDist =
TruncatedDistribution[{0, \[Infinity]}, CauchyDistribution[a, b]],
aMean}, aMean = Mean@aDist;
Plot[PDF[aDist, x], {x, -3, 10}, PlotRange -> Full,
Epilog -> Line[{{aMean, 0}, {aMean, 10}}]]], {a, 0, 10}, {b, 1,
10}]
Does anyone know what this might be happening? Is the expression correct, or is it a mirage? (I'm guessing it's to do with the fat tails of this distribution that mean that its integral is not well-defined, but am not sure).
Best,
Ben