## Need to find the distribution from mean & standard deviation

on 17 May 2018

### Charanraj (view profile)

on 18 May 2018
Hello,
I need a 100 numbers of distribution for a specified mean & std. I found one, but its not accurate. The one I found is below-
sig_R_lrs=18.37e3;
mu_R_lrs=16.49e3;
sig_G_lrs=1/sig_R_lrs;
mu_G_lrs=1/mu_R_lrs;
y_lrs=sig_G_lrs.*randn(100,1)+mu_G_lrs;
here mean(y_lrs) or std(y_lrs) is not accurate. Also came across r = normrnd(16.49e3,18.37e3,[1,100]), but even here i don't get an exact mean & std :(
Any suggestion of getting an accurate mean & std and determining the distribution ?

dpb

### dpb (view profile)

on 17 May 2018
y is a random sample from a PRNVariate with the specified mean and standard deviation; the sample isn't the distribution but a single possible realization; you can't expect the statistics computed from the sample to be identical to the parameters.
Stephen Cobeldick

### Stephen Cobeldick (view profile)

on 17 May 2018
"i don't get an exact mean & std"
In general a sample will not have the same mean, standard deviation, etc. as the distribution. Take it down to the logical extreme: does a sample of one value have the same mean value as whatever random distribution it was picked from? In general you would not expect this.
Please explain why you expect a random sample to have that exact mean and standard deviation.
dpb

### dpb (view profile)

on 17 May 2018
"does a sample of _one value have the same mean value as whatever random distribution it was picked from?"_
Well, it might, but odds aren't good... VBG (de' debbil made me do it!)

### Image Analyst (view profile)

on 17 May 2018

To learn about the "standard error of the mean" (which you're talking about even if you don't realize it), see Wikipedia https://en.wikipedia.org/wiki/Standard_error

### Jeff Miller (view profile)

on 18 May 2018

As others have said, you should not expect the randomly sampled values to match the true mean and sd exactly, due to random sampling error. If you do want to construct an artificial sample where the values do match exactly (even though this is not a true random sample), you can do so like this:
sig_R_lrs=18.37e3;
mu_R_lrs=16.49e3;
sig_G_lrs=1/sig_R_lrs;
mu_G_lrs=1/mu_R_lrs;
r = randn(100,1);
rsd = std(r);
r2=r/rsd*sig_G_lrs;
y_lrs=r2 + (mu_G_lrs-mean(r2));