Suppose the data follow normal distribution, with mean μ and standard deviation σ, or in experiment, we call the s.d. be error or fluctuation. and the μ is the hypothetical true mean.

now we take several data and by that, we want to know

1. How many data should be taken to make the different between data mean and true mean is less then certain value, say, ½ s.d. be 95.5%?
2. what is the confident interval for our data mean from n-th data is within 2 s.d. or 95.5%?

first, let us establish the data statistic. say, we have n-th data: X1, X2, … , Xn, all from the same sample space of a normal distribution ( for example ). we write:

$X_i ~ N(\mu, \sigma^2)$

and that the data mean

$\bar{X} = \frac{a}{n} \sum X_n$

should follow the usual rule of summing up normal distribution:

$a X+b Y ~ N( a \mu_X + b \mu_Y , a^2 \sigma_X^2 + b^2 \sigma_Y^2 )$

thus,

$\bar{X} ~ N ( \mu, \sigma^2 / n )$

therefore, let our calculated data mean be $\hat{\theta}$, the probability that the data mean is within certain number of error is:

$P( |\hat{\theta} - \mu| < \alpha)$

using standardized normal distribution:

$z = ( \hat{theta} - \mu ) / (\sigma /\sqrt{n} )<\beta=\alpha\sqrt{n}/\sigma$

the number of data we should take to make the probability larger then 95.5% or 2 s.d. require:

$\beta > 2 => n > 4 \sigma^2 / \alpha^2$

or in general, with  number of s.d. ( γ ),

$\beta > \gamma => n > ( \gamma \sigma / \alpha ) ^2$

this mean, a higher probability or lower different, we need more data. In fact, $(\hat{\theta} -\alpha , \hat{\theta} + \alpha )$  is what we called confident interval or 95.5 %, which is directly related to the number of s.d. ( γ ).

now, there are few parameter, data mean $\hat{theta}$, sample s.d. $\sigma$, number of data n, confident interval and absolute different from the true mean α. we can rephrase question:

1.  given $\hat{\theta} , \sigma, \alpha , \gamma$ , what is n?
2. given $\hat{\theta} , \sigma, \gamma , n$ , what is α ?

which mean, the 2nd question is revert the process. thus,

$\alpha > \gamma \sigma /\sqrt{n}$

thus, a larger probability, the larger the confident interval. and which is quite obvious. a large interval will have more chance to cover the true mean.

### Hypothesis testing

in the above discussion, we assumed that the……..

**************************** example ****************

for coin tossing: if we want to know whether the coin was unbiased, i.e, the expected value is different from 0.5. if we want the different is less then 0.1, thus, we have to at least toss the coin for 25 times for having 99.5% confident for the expected value within (0.4 , 0.6). In fact, if we tossed a coin for 25 times, and the data mean is 0.6, we have 99.5% confident that the coin is unbiased around ( 0.5, 0.7). this is same as testing in casino.

if we have only tossed a coin for 10 times, what is the confident interval for having 99.5% confident the true mean is with it? the answer is ( x – 0.32 , x + 0.32 ).

Now, for example, i tossed a coin with 11 head and 14 tail. thus, i have 99.5% confident that the true chance of head is lying between ( 0. 34, 0.54 ) and the true chance for the tail is ( 0.46, 0.66) thus, there is a overlap of those chance.

However, in the above discussion, we assumed the standard deviation for the coin is 0.5, which is from the assumption that the coin is unbiased. So, it is quite a looping logic. we assumed the coin is unbiased and then find whether it is unbiased.

To solve this, the hypothesis testing is required. it runs like this:

we assumed the coin is unbiased, μ=0.5 , thus, we will have the theoretical distribution, say, the 99.5% confident interval should be lay on ( 0.4, 0.6) for n=25. We also have to set the accept region or reject region, say, 0.5% or z = 1.96 for standardized normal distribution. Thus, we do experiment, and say, after the 25 tosses, we have 11 heads, thus, the standardized z is :

$z = ( 0.44 - 0.5) / ( 0.5 / 5) = 0.6$

thus, this result is accepted and the hypothesis that the coin is unbiased is true. or we can see, by the fact that the data mean is within the 99.5% confident interval, thus, we should accept the hypothesis. However, there is still a chance for the true mean is not at 0.5 and outside the region (0.4, 0.6), by 0.5% chance. this is called type II error, or false true. in more concrete:

P( 0.4 < θ < 0.6 | μ < 0.4 or μ > 0.6 ) = 0.5%

and also there is a chance that we reject the hypothesis by getting our data mean not in the region, this is called Type I error, or true negative.

P( θ < 0.4 or θ > 0.6| 0.4 < μ < 0.6 )

****Remark ****

the hypothesis testing is not quite sure.