# “Unexpected” expectation

Can any of our Monte Carlo experts explain the “unexpected” expectation at the end of this answer?

Ex post facto summary of the other question/answer: if $X_1,\dots,X_n$ are IID random variables and the expectations $\mathrm{E}[X_i/\bar{X}]$ exist, then a simple symmetry argument shows that $\mathrm{E}[X_i/\bar{X}]=1$, but a Monte Carlo experiment with $X_i\sim\mathrm{N}(0,1)$ seems to contradict this proposition.

x <- matrix(rnorm(10^6), nrow = 10^5)
mean(x[,2]/rowMeans(x))

[1] 5.506203


The explanation to the Monte Carlo evaluation of the ratio $\mathbb{E}[X_1/(X_1+X_2)]$ taking weird values is that the expectation does not exist. As a transform of a Cauchy $X_1/X_2$ in your Normal example. Indeed,
\begin{align*}
\mathbb{E}[X_1/(X_1+X_2)]
&=\mathbb{E}[1/(1+X_2/X_1)]\\
&=\int_{-\infty}^{+\infty} \frac{1}{1+y}\,\frac{1}{\pi(1+y^2)}\text{d}y
\end{align*}
which is not integrable at $y=-1$ since equivalent to $(y+1)^{-1}$.

Note that $X_1/\bar{X}$ is not a Cauchy variate but the transform of a Cauchy variate by the function$$f:\ y \to \dfrac{n}{1+\sqrt{n-1}y}$$The reason is that$$(X_2+\ldots+X_n)\sim\text{N}(0,n-1)$$and that
$$\frac{X_1}{\bar{X}}=\dfrac{n}{1+(X_2+\ldots+X_n)/X_1}=\dfrac{n}{1+\sqrt{n-1}Z/X_1}$$where $Z\sim\text{N}(0,1)$.

Note that, as $n$ grows to infinity, $X_1/\bar{X}$ converges in distribution to the random variable equal to $\pm \infty$ with probability $1/2$.