# Thread: Plotting deviation from mean

1. ## Plotting deviation from mean

Hi,
Hoping to get some insight into how to plot variance to mean along with graphing the normal distribution.

I have three mumbers which I'm hoping to be able to use to graph a normal distribution

Mean = 87.85
Std.Dev = 8.38
Entire sample size = 10,000,000,000

The other thing I need to do is understand the expected deviation from mean after X number of results, which might be as little as 5% of the Entire sample needed to establish the mean....

Any guidance appreciated

2. I do not get your first question, could you give some further explanation on what you want to do with it? On the other hand the second one is a bit weird. The mean is the expected value, therefore you do not expect any deviation from the mean. However, you can determine the number of trials for which you are almost certain that you find the mean. If that is what you were looking for, tell me and I'll try to help you.

3. Originally Posted by Pim
I do not get your first question, could you give some further explanation on what you want to do with it? On the other hand the second one is a bit weird. The mean is the expected value, therefore you do not expect any deviation from the mean. However, you can determine the number of trials for which you are almost certain that you find the mean. If that is what you were looking for, tell me and I'll try to help you.
Well, The two 'questions' go hand in hand.

What I want to use it for... I work in the gamng industry and while I understand that gaming machines cannot be expected to perform to mean over a small(ish) sample of results I'm hoping to be able to establish just how much of a deviance from the mean is within reason (follows normal distribution).
Many modern gaming machines have a 'cycle' (# of unique results) of more than 10,000,000 and have a mean of between 87% and 97% and a standard deviation of less than 15. Results at 68% of the cycle fall within (+/-) 5% on the mean.
This is all good.
But when I need to prove that the results after say 50,000 events are within the expected range of variance I come unstuck - can't do the math (don't even know where to start).
So, as a starting point I have three things:
• Number of unique results (cycle)
• Mean (of complete cylce)
• Standard deviation
I'm hoping to be able to plot the distribution (and result of for question 2) on a graph to illustrate to other math bumblers like me.

4. The problem with statistics is that you cannot exactly prove something, seeing as there are random numbers in it. However, you can say with say 99% certainity that your sample has the same mean as the whole population.

To calculate this you need the standardized normal distribution and the table that goes with it. Now say that you would like to establish with 99% certainity that your population mean is within 0.01 of the sample mean you'll get from the testing.

$
\overline{X} \pm z_{c} \frac{\sigma}{\sqrt{n}}
$

You know the mean and standard deviation, you know your wanted confidence level ( $z_{c}$) which for 99% matches with 2.58 so you can calculate the amount of trials you will need.

$
z_{c} \frac{\sigma}{\sqrt{n}}= 0.01
$

$
2.58 \frac{8.38}{\sqrt{n}} = 0.01
$

$
\frac{21.6204}{\sqrt{n}} = 0.01
$

$
\frac{21.6204}{0.01} = \sqrt{n}
$

$
\sqrt{n} = 2162.04
$

$n = 2162.04^2$

$
n = 4674416.962
$

Now this is a rather lot more than the 50,000 you were hoping for.

If you'd use 50,000 samples you will get the following. (99% certainity)

$
= z_{c} \frac{\sigma}{\sqrt{n}}$

$= 2.58 \frac{8.38}{\sqrt{50000}} = 0.096689$

Which comes down to

$
\overline{X} \pm 0.096689
$

If you would do 50,000 trials, you can say with 99% certainity that the mean of the game is within 0.096689 of the sample mean you get.

Now, there is a similar thing for the standard devation:

$
\frac{\hat{S}\sqrt{n-1}}{\chi_{0.995}} \leq \sigma \leq \frac{\hat{S}\sqrt{n-1}}{\chi_{0.005}}
$

To get $\chi_{0.995}$ and $\chi_{0.005}$
we can use the fact that $\sqrt{2 \chi^2} - \sqrt{2v-1}$ closely approximates the normal distribution with mean 0 and variance 1. (Standardized normal distribution)
$
\chi^2_{0.995} = 0.5(z_{0.995} + \sqrt{2v -1})^2
$

$
\chi^2_{0.995} = 0.5(2.85 + \sqrt{2(49999)-1})^2 = 50903.797
$

$
\chi_{0.995} = \sqrt{50903.797} = 225.619
$

$
\chi^2_{0.005} = 0.5(z_{0.005} + \sqrt{2v -1})^2
$

$
\chi^2_{0.005} = 0.5(-2.85 + \sqrt{2(49999)-1})^2 = 49101.326
$

$
\chi_{0.005} = \sqrt{49101.326} = 221.588
$

$
\frac{\hat{S}\sqrt{49999}}{225.619} \leq \sigma \leq \frac{\hat{S}\sqrt{49999}}{221.588}
$

$
\hat{S} 0.99107 \leq \sigma \leq \hat{S} 1.00910
$

If you plug your obtained sample standard deviation in this formula, you can say with 99% certainity that your actual standard deviation is within these boundaries.

You can plot the distribution by using the normal distribution density function, where you can plug in the mean and standard deviation. (Normal distribution - Wikipedia, the free encyclopedia) For the answer on question 2, you could plot your certainity, by plotting a standardized normal distribution (as that is how I approximated it.) Where you color the parts from -2.85 to 2.85.