# Test whether two datasets come from the same distribution (in two dimensions)

I have two samples of two-dimensional points:

$$D_1 = (\vec x_1, \vec x_2, \dots, \vec x_n)$$ $$D_2 = (\vec y_1, \vec y_2, \dots, \vec y_m)$$

Note that the samples do not have the same length. The points are two-dimensional:

$$\vec x_i = (x_{i1},x_{i2})$$

I need a statistical test for the null hypothesis that $D_1$ and $D_2$ come from the same bivariate distribution. I do not know a priori what the distribution is. But I expect this: That the second coordinate of each point equals a function of the first coordinate, plus noise. You can disregard this last fact if it is not useful.

Also, a package (a function in R?) to perform the test would be useful.