I am solving a problem from 17th Kolmogorov competition. Let $(x,y)$ be a Gaussian random vector with mean $(0,0)$ and a covariance matrix $$\left(\begin{array}{cc} 1&r\\r&1\end{array} \right),$$ where $|r|\le 1$. Find mean and variance of $\max(x,y)$. My try in 13.2 on Windows 10 is as follows.
Mean[TransformedDistribution[Max[x, y], {x, y} \[Distributed]
BinormalDistribution[{0, 0}, {1, 1}, r]]]
(2 Sqrt[1 - r] + Sqrt[2] r - Sqrt[2] r^2 + Sqrt[2] (-1 + r) Abs[r])/(2 Sqrt[\[Pi]])
Variance[TransformedDistribution[ Max[x, y], {x, y} \[Distributed]
BinormalDistribution[{0, 0}, {1, 1}, r]]]
Piecewise[{{(-1 + Pi + r)/Pi, Inequality[0, LessEqual, r, Less, 1]}}, (-1 + Pi + r + 2*r^2 - 4*r^3 + 2*r^4)/Pi]
If $r=-1$, then $\max(x,y)=|x|$ and the above results are not in accordance with
Mean[TransformedDistribution[RealAbs[x], x \[Distributed] NormalDistribution[0, 1]]]
Sqrt[2/\[Pi]]
and
Variance[TransformedDistribution[RealAbs[x], x \[Distributed] NormalDistribution[0, 1]]]
(-2 + \[Pi])/\[Pi]
I think it should be r
instead of Abs[r]
in the result for the mean.
How to obtain the correct results with Mathematica?
PS.Rewriting $\max(x,y)$ in other formulas does not help:
Mean[TransformedDistribution[(RealAbs[x - y] + RealAbs[x + y])/2,
{x, y} \[Distributed] BinormalDistribution[{0, 0}, {1, 1}, r]]]
(Sqrt[1 - r] - Sqrt[2] r^2 + Sqrt[1 + r] + Sqrt[2] r Abs[r])/Sqrt[\[Pi]]
Mean[TransformedDistribution[ RealAbs[x - y]/2, {x, y} \[Distributed]
BinormalDistribution[{0, 0}, {1, 1}, r]]] +
Mean[TransformedDistribution[RealAbs[x + y]/2, {x, y} \[Distributed]BinormalDistribution[{0, 0}, {1, 1}, r]]]
Sqrt[1 - r]/Sqrt[\[Pi]] + Sqrt[1 + r]/Sqrt[\[Pi]]
Abs[r]==1
the covariance matrix{{1, r}, {r, 1}}
is not invertible. How is the Gaussian defined then? $\endgroup$r==-1
should be considered as the limit whenr
tends to- 1
from above. BTW, OK withr==1
. Second, there are problems with other negative values ofr
. For example,(2 Sqrt[1 - r] + Sqrt[2] r - Sqrt[2] r^2 + Sqrt[2] (-1 + r) Abs[r])/( 2 Sqrt[\[Pi]]) /. r -> -0.5
produces0.0925749
, whereasMean[TransformedDistribution[ Max[x, y], {x, y} \[Distributed] BinormalDistribution[{0, 0}, {1, 1}, -0.5]]]
results in0.690988
. $\endgroup$