# Sampling data following some arbitrary normal distributions

Let say I have a matrix $$D_{N \times 3}$$ which its columns are $$x, y, z$$ and assume that assume that $$N$$ is a huge number and all $$x, y, z$$ are sampled from 3 different uniform distributions.

Now, I want to select a subset of rows and store it in $$d_{m \times 3}$$ (so $$d \in D$$) such that the selected rows meet the following criterias:

• $$x_d = d[:, 0] \sim \mathcal{N}(\mu_x, \sigma^2_x)$$
• $$y_d = d[:, 1] \sim \mathcal{N}(\mu_y, \sigma^2_y)$$
• $$z_d = d[:, 2] \sim \mathcal{N}(\mu_z, \sigma^2_z)$$

Note that all $$\mu_x, \sigma^2_x, \mu_y, \sigma^2_y, \mu_z, \sigma^2_z$$ are specified by user and you can assume that specified averages and variances are within the original data. My question is, what is the best way to sample data to meet the criteria?

As a simple example if we had the following data on $$D$$:

X    Y    Z
1    2    3
2    3    8
3    4    9
1    1    1
2    6    6


and we had only one criteria to meet $$x_d = d[:, 0] \sim \mathcal{N}(\mu_x=1, \sigma^2_x=0)$$. Then $$d$$:

X    Y    Z
1    2    3

# OR

X    Y    Z
1    2    3
1    1    1


are both valid solutions. Note that there could be no answer exist, the answer should have the closest possible. If multiple answers exist, then any of them would be fine.

• Thank you for the edits. It sounds like you are actually asking for the sample mean and sample standard deviation to match desired values, which is different from asking for the distribution (e.g., the shape of the histogram) to match. Is that correct? The text talks about matching the distribution, but the example and your comments suggest you want to match the sample mean and standard deviation (I suspect this is what you actually want). Those are two different questions. Please edit the question to clarify which you are asking.
– D.W.
Mar 26 at 23:54