# Testing mean. ```Statistical testing
It is often necessary to test if a certain parameter in a population can be
correct. The population is supposed to be normally distributed.
Test is based on a sample.
Two most common parameters to be tested are
- Mean (Average)
- Percentage share
Testing procedure starts with collecting a sample from the target population.
After that a test variable is calculated. If the sample size is at least 30, the z –
test is used.
Testing the Average
Example.
A machine is packing matches into boxes, where should be
averagely 40 matches in each.
50 boxes are selected and number of matches in each box is
counted.
Average number of matches/box was 39,1
Standard deviation was 1,9
Zero-hypothesis (H0) is “Average is 40”
Alternative hypothesis (H1) is “Average is less than 40”
The test variable is calculated:
z
x

n
x = Sample Average = 39,1
 = Average based on the zero-hypothesis = 40
 = Standard deviation = 1,9
n = Sample size = 50
z
39,1  40
39,1  40

 50   3,349
1,9
1,9
50
Value of z is compared to a critical value.
Critical value is based on the confidence level of the test and
there is also a difference between one-tailed and two-tailed
test.
Two-tailed test:
“Average based on the zero-hypothesis is incorrect.”
It does not matter if the claimed average is higher or lower
than the correct one.
One-tailed test:
Two options:
- “Average based on the zero-hypothesis is too high.”
- “Average based on the zero-hypothesis is too low.”
Confidence level tells the probability for getting the test sample
in the case that the claimed average (based on the zerohypothesis) is correct.
If the test shows, that the zero-hypothesis-based average can’t
be true, the probability (=confidence) of our alternative
hypothesis = 100 % - confidence level %.
Confidence
level
5%
1%
0,1%
Probability of alternative
hypothesis
95%
99%
99,9%
Critical values of z-test: (Sample size must be at least 30)
2-tailed
1-tailed
5%
1,960
1,645
1%
2,576
2,326
0,1 %
3,291
3,090
Conclusion:
Absolute of our z-value (-3,349) equals 3,349, which is greater
than the critical value of the 1-tailed test, even with the 0,1%
level. Thus we can tell that average number of matches in a
box is less than 40.
```