1
$\begingroup$

I am give a sequence of tasks. The each next task is the continuation of the previous one. I managed to solve all of them, except the last. In the first two tasks I was asked to find marginal distributions, expected value of the random vector and variance-covariance matrix. $$ \newcommand{\u}[1]{\underline{#1}} p(x) = \begin{cases} 1/\pi,\text{ if }x_1^2 + x_2^2 < 1 \\ 0, \text{ otherwise} \end{cases} $$ $$ p_\underline{x_1} = \int_{-\sqrt{1 - x_1^2}}^{\sqrt{1 - x_1^2}} \frac{1}{\pi} dx_2 = \frac{2}{\pi}\sqrt{1 - x_1^2} $$

$$ p_\underline{x_2} = \int_{-\sqrt{1 - x_2^2}}^{\sqrt{1 - x_2^2}} \frac{1}{\pi} dx_1 = \frac{2}{\pi}\sqrt{1 - x_2^2} $$ $$ \mathbb{E}(\underline x) = \begin{bmatrix} 0 \\ 0 \end{bmatrix} $$ $$ Var(\underline{x}) = \begin{bmatrix} \frac{1}{4} & 0 \\ 0 & \frac{1}{4} \end{bmatrix} $$ For the next tasks I have the linear transformation of the random vector. Again I have to find the expected value, variance-covariance matrix and using Chebyshev inequality find the radius where at least 90% of probability is: $$ \u{y} = \begin{bmatrix} 1 & -1 \\ 0 & 2 \end{bmatrix} \u{x} + \begin{bmatrix} 2 \\ 3 \end{bmatrix} \\ $$ $$ \mathbb{E}(b + A\u{x}) = \begin{bmatrix} 2 \\ 3 \end{bmatrix} $$ $$ Var(b + A\u{x}) = \begin{bmatrix} \frac{1}{2} & -\frac{1}{2} \\ -\frac{1}{2} & 1 \end{bmatrix} $$ $$ P(||\u{x} - \mathbb{E}(\u{x})||^2 < \frac{tr(var(\u{x}))}{1 - \alpha}) \ge \alpha => \text{ radius } = \sqrt{15} $$ Lastly I am asked to plot with equal axis (it will look like a circle) the points of the linearly transformed distribution and the circle with the calculated radius. This is the task where I am stuck. I generated points uniformly within Chebyshev's radius. Plot on the left is the stretched circle and on the right is the same with equal axes. The plots contain 90% of the data. So I have to plot the rest 10%, which must be outside the circle/ellipse. enter image description here

I imagined that this transformation stretches the unit circle into an ellipse. In the case of unit circle I can generate points from uniform distribution values between -1 and 1. How to determine the range in the case of the ellipse? What is this radius then? Is there any connection with eigen vectors? Sure, I can generate points within the unit circle and then transform them with the matrix given, but I think this is not the solution, which I have to provide. I provided all previous tasks and answers because there must be connection (I think).

$\endgroup$
6
  • $\begingroup$ Why not generate random points in the rectangle that contains the ellipse, and then throw out any points that land outside the ellipse? It's not the most efficient, but it's the easiest solution. $\endgroup$
    – BGreen
    Jan 7 at 19:58
  • $\begingroup$ I think that I have to provide an analytical solution for that. Because of this the question is here. I can generate the point in a way you told but the question about the actual radius is torturing me. $\endgroup$ Jan 7 at 20:00
  • $\begingroup$ Another approach would be to work backward from the solution. If you want points evenly spaced in the vertical and horizontal directions after stretching the vertical direction, then you just need to make the initial distribution more dense in the vertical direction so when it is stretched, the 2D distribution is uniform. $\endgroup$
    – BGreen
    Jan 7 at 20:14
  • $\begingroup$ Thank you for your hint, but I am not sure that I understood what do you mean. Could you please provide some link, where I could read about that? $\endgroup$ Jan 7 at 20:16
  • 1
    $\begingroup$ Suppose that you want your uniform distribution to have $x$ points per unit length in the horizontal and vertical directions. If you generate a distribution in this way and then stretch the vertical direction by a factor $K$, then you will have $x$ points per unit length in the horizontal direction and $x/K$ per unit length in the vertical direction. To fix this, generate an initial distribution with $x$ per unit length in the horizontal direction and $Kx$ per unit length in the vertical direction, and then stretch. The result will have $x$ per unit length in both directions. $\endgroup$
    – BGreen
    Jan 7 at 20:28
1
$\begingroup$

In a 2D case, generating a random point in a bounding rectangle and throwing away points outside the ellipse isn't that ineffective. However, it is very ineffective if you generalise it for high dimension. I will tell you a way which is intuitive, effective for high dimension and it is guaranteed to terminate in fixed time.

You imagine that the ellipse is a bottle. You calculate the volume and you spill random amount of water into the bottle. The random point you are looking for is somewhere on the level of water. In this case, it is a line. This way, the task reduced by one dimension. Next thing you have to do is choosing a random point of the line you got, which is trivial.

The same thing more formally: You choose the $x$-coordinate by the marginal distribution $p(x)$. After that, you choose the $y$-coordinate by the distribution given $x$, i.e. $p(y|x)$. And you are done.

You can use the same trick for other shapes also, for example simplexes.

$\endgroup$
1
  • $\begingroup$ Thank you for your answer. I have to think about that and imagine this bottle. $\endgroup$ Jan 7 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.