Testing the hypothesis of a normal distribution. Pearson's criterion for testing the hypothesis about the form of the law of distribution of a random variable
Task 1.
Using the Pearson test, at the significance level a= 0.05 check if the hypothesis about the normal distribution of the population is consistent X with empirical sample size distribution n = 200.
Decision.
1. Calculate and sample mean standard deviation .
2. Calculate the theoretical frequencies, taking into account that n = 200, h= 2, = 4.695, according to the formula
.
Let's make a calculation table (values of the function j(x) are given in Appendix 1).
i |
||||
3. Let's compare empirical and theoretical frequencies. Let's make a calculation table, from which we will find the observed value of the criterion :
i |
|||||
Sum |
According to the table of critical distribution points (Appendix 6), by significance level a= 0.05 and the number of degrees of freedom k = s- 3 \u003d 9 - 3 \u003d 6 we find the critical point of the right-hand critical region (0.05; 6) \u003d 12.6.
Since =22.2 >= 12.6, we reject the hypothesis of the normal distribution of the general population. In other words, the empirical and theoretical frequencies differ significantly.
Task2
Statistical data are presented.
Diameter measurement results n= 200 rolls after grinding are summarized in table. (mm):
Table Frequency variation series of roll diameters
i | ||||||||
xi, mm |
||||||||
xi, mm |
||||||||
Required:
1) compose a discrete variational series, ordering it if necessary;
2) identify the main numerical characteristics row;
3) give a graphical representation of the series in the form of a polygon (histogram) of the distribution;
4) construct a theoretical normal distribution curve and check the correspondence between the empirical and theoretical distributions using the Pearson criterion. When testing the statistical hypothesis about the type of distribution, take the significance level a = 0.05
Decision:
The main numerical characteristics of this variation series find by definition. The average diameter of the rolls is (mm):
x cp = = 6.753;
corrected dispersion (mm2):
D = = 0,0009166;
corrected standard deviation (mm):
s = = 0,03028.
Rice. Frequency distribution of roll diameters
The initial (“raw”) frequency distribution of the variation series, i.e. conformity ni(xi), is characterized by a rather large spread of values ni relative to some hypothetical "averaging" curve (Fig.). In this case, it is preferable to construct and analyze an interval variation series by combining frequencies for diameters falling within the corresponding intervals.
Number of interval groups K we define by the Sturgess formula:
K= 1 + log2 n= 1 + 3.322lg n,
where n= 200 – sample size. In our case
K= 1 + 3.322×lg200 = 1 + 3.322×2.301 = 8.644 » 8.
The width of the interval is (6.83 - 6.68)/8 = 0.01875 » 0.02 mm.
The interval variation series is presented in Table.
Table Frequency interval variation series of roll diameters.
k | ||||||||
xk, mm |
||||||||
The interval series can be visually represented as a histogram of the frequency distribution.
Rice. Frequency distribution of roll diameters. The solid line is a smoothing normal curve.
The form of the histogram allows us to make an assumption that the distribution of roll diameters obeys the normal law, according to which the theoretical frequencies can be found as
nk, theor = n× N(a; s; xk)×D xk,
where, in turn, the smoothing Gaussian normal distribution curve is given by:
N(a; s; xk) = .
In these expressions xk are the centers of intervals in the frequency interval variation series.
For example, x 1 = (6.68 + 6.70)/2 = 6.69. As center estimates a and the parameter s of the Gaussian curve can be taken:
a = x cf.
From fig. it can be seen that the Gaussian curve of the normal distribution as a whole corresponds to the empirical interval distribution. However, you should make sure statistical significance this correspondence. Let us use Pearson's criterion of goodness of fit c2 to check whether the empirical distribution corresponds to the empirical one. To do this, calculate the empirical value of the criterion as the sum
= ,
where nk and nk,theor are empirical and theoretical (normal) frequencies, respectively. It is convenient to present the calculation results in tabular form:
Table Calculations of the Pearson criterion
[xk, xk+ 1), mm |
xk, mm |
nk,theor |
||
critical value we find the criterion using the Pearson table for the significance level a = 0.05 and the number of degrees of freedom d.f. = K – 1 – r, where K= 8 is the number of intervals of the interval variation series; r= 2 is the number of parameters of the theoretical distribution estimated based on the sample data (in this case, the parameters a and s). Thus, d.f. = 5. The critical value of the Pearson criterion is crit(a; d.f.) = 11.1. Since c2emp< c2крит, заключаем, что согласие между эмпирическим и теоретическим нормальным распределением является статистическим значимым. Иными словами, теоретическое normal distribution describes the empirical data satisfactorily.
Task3
Chocolate boxes are packed automatically. 130 of the 2000 packages contained in the lot were taken under the scheme of self-random non-repeating sampling, and the following data were obtained on their weight:
It is required using the Pearson test at a significance level a=0.05 to test the hypothesis that the random variable X - the weight of packages - is distributed according to the normal law. Construct a histogram of the empirical distribution and the corresponding normal curve on one graph.
Decision
1012,5
= 615,3846
Note:
In principle, the corrected sample variance should be taken as the variance of the normal distribution. But since the number of observations - 130 is large enough, then the “usual” one will do.
Thus, the theoretical normal distribution is:
[xi; xi+1]
Empirical Frequencies
niProbabilities
pi
Theoretical frequencies
npi
(ni-npi)2
ODA The criterion for testing the hypothesis about the proposed law of the unknown distribution is called the goodness-of-fit criterion.
There are several goodness of fit criteria: $\chi ^2$ (chi-square) by K. Pearson, Kolmogorov, Smirnov, and others.
Usually theoretical and empirical frequencies differ. The case of discrepancy may not be random, which means that it is explained by the fact that the hypothesis is not correctly chosen. The Pearson criterion answers the question, but, like any criterion, it does not prove anything, but only establishes its agreement or disagreement with the observational data at the accepted level of significance.
ODA A sufficiently small probability at which an event can be considered almost impossible is called the level of significance.
In practice it is common to take significance levels between 0.01 and 0.05, $\alpha =0.05$ being the $5 ( \% ) $ significance level.
As a criterion for testing the hypothesis, we take the value \begin(equation) \label ( eq1 ) \chi ^2=\sum ( \frac ( (( n_i -n_i" ))^2 ) ( n_i" ) ) \qquad (1) \ end(equation)
here $n_i -$ empirical frequencies obtained from the sample, $n_i" -$ theoretical frequencies found theoretically.
It is proved that for $n\to \infty $ the law of distribution of the random variable ( 1 ), regardless of the distribution law of the general population, tends to the law $\chi ^2$ ( chi-square ) with $k$ degrees of freedom.
ODA The number of degrees of freedom is found by the equation $k=S-1-r$ where $S-$ is the number of interval groups, $r-$ is the number of parameters.
1) uniform distribution: $r=2, k=S-3$
2) normal distribution: $r=2, k=S-3 $
3) exponential distribution: $r=1, k=S-2$.
rule . Testing the hypothesis by Pearson's criterion.
- To test the hypothesis, calculate the theoretical frequencies and find $\chi _ ( obs ) ^2 =\sum ( \frac ( (( n_i -n_i" ))^2 ) ( n_i" ) ) $
- According to the table of critical distribution points $\chi ^2$, $\chi _ ( cr ) ^2 (( \alpha ,k ))$ is found by the given significance level $\alpha $ and the number of degrees of freedom $k$.
- If $\chi _ ( obs ) ^2<\chi _ { кр } ^2 $ то нет оснований отвергать гипотезу, если не выполняется данное условие - то отвергают.
Comment To control calculations, use the formula for $\chi ^2$ in the form $\chi _ ( obs ) ^2 =\sum ( \frac ( n_i^2 ) ( n_i" ) -n ) $
Testing the Hypothesis of Uniform Distribution
The density function of the uniform distribution of $X$ has the form $f(x)=\frac ( 1 ) ( b-a ) x\in \left[ ( a,b )\right]$.
In order to test the hypothesis that a continuous random variable is uniformly distributed at a significance level of $\alpha $, it is required:
1) Find the sample mean $\overline ( x_b ) $ and $\sigma _b =\sqrt ( D_b ) $ from the given empirical distribution. Take as an estimate of the parameters $a$ and $b$ the quantities
$a = \overline x _b -\sqrt 3 \sigma _b $, $b = \overline x _b +\sqrt 3 \sigma _b $
2) Find the probability that a random variable $X$ falls into partial intervals $(( x_i ,x_ ( i+1 ) ))$ using the formula $ P_i =P(( x_i 3) Find the theoretical (equalizing) frequencies using the formula $n_i" =np_i $. 4) Assuming the number of degrees of freedom $k=S-3$ and the significance level $\alpha =0.05$ from the tables $\chi ^2$, we find $\chi _ ( cr ) ^2 $ from the given $\alpha $ and $k$, $\chi _ ( cr ) ^2 (( \alpha ,k ))$. 5) Using the formula $\chi _ ( obs ) ^2 =\sum ( \frac ( (( n_i -n_i" ))^2 ) ( n_i" ) ) $ where $n_i are $ empirical frequencies, we find the observed value $\ chi _ ( obs ) ^2 $. 6) If $\chi _ ( obs ) ^2<\chi _ { кр } ^2 -$ нет оснований, отвергать гипотезу. Let's test the hypothesis on our example. 1) $\overline x _b =13.00\,\,\sigma _b =\sqrt ( D_b ) = 6.51$ 2) $a=13.00-\sqrt 3 \cdot 6.51=13.00-1.732\cdot 6.51=1.72468$ $b=13.00+1.732\cdot 6.51=24.27532$ $b-a=24.27532-1.72468=22.55064$ 3) $P_i =P(( x_i $P_2 =((3 $P_3 =((7 $P_4 =((11 $P_5 =((15 $P_6 =((19 In a uniform distribution, if the length of the interval is the same, then $P_i -$ are the same. 4) Find $n_i" =np_i $. 5) Find $\sum ( \frac ( (( n_i -n_i" ))^2 ) ( n_i" ) ) $ and find $\chi _ ( obs ) ^2 $. Let's put all the obtained values in the table \begin(array) ( |l|l|l|l|l|l|l| ) \hline i& n_i & n_i" =np_i & n_i -n_i" & (( n_i -n_i"))^2& \frac ( (( n_i -n_i")^2 ) ( n_i" ) & Control~ \frac ( n_i^2 ) ( n_i" ) \\ \hline 1& 1& 4.43438& -3.43438& 11.7950& 2.659898& 0.22551 \\ \hline 2& 6& 4.43438& 1.56562& 2.45117& 0.552765& 8.11838 \\ \hline 3& 3& 4.43438& -1.43438& 2.05744& 0.471463& 2.0296 \\ \hline 4& 3& 4 .43438& -1.43438& 2.05744& 0.471463& 2.0296 \\ \hline 5& 6& 4.43438& 1.56562& 2.45117& 0.552765& 8.11838 \\ \hline 6& 6& 4.43438& 1.562 45117& 0.552765& 8.11838 \\ \hline & & & & & \sum = \chi _ ( obs ) ^2 =3.261119& \chi _ ( obs ) ^2 =\sum ( \frac ( n_i^2 ) ( n_i" ) -n ) =3.63985 \\ \hline \end(array) $\chi _ ( cr ) ^2 (( 0.05.3 ))=7.8$ $\chi _ ( obs ) ^2<\chi _ { кр } ^2 =3,26<7,8$ Conclusion there is no reason to reject the hypothesis. The rule by which the hypothesis R 0 is rejected or accepted is called statistical criterion. The name of the criterion, as a rule, contains a letter, which denotes a specially compiled characteristic from paragraph 2 of the statistical hypothesis testing algorithm (see paragraph 4.1), calculated in the criterion. Under the conditions of this algorithm, the criterion would be called "in-criterion". When testing statistical hypotheses, two types of errors are possible: Probability a make a type one error is called the significance level of the criterion. If for R denote the probability of making a Type II error, then (l - R) - the probability of not making a type II error, which is called the power of the criterion. There are several types of statistical hypotheses: We will consider the hypothesis about the law of distribution on the example of Pearson's x 2 goodness-of-fit test. Concordance criterion called a statistical test for testing the null hypothesis about the alleged law of the unknown distribution. Pearson's goodness-of-fit test is based on a comparison of empirical (observed) and theoretical frequencies of observations calculated under the assumption of a certain distribution law. Hypothesis # 0 here is formulated as follows: the general population is normally distributed according to the criterion under study. Statistical Hypothesis Testing Algorithm #0 for Criteria x 1 Pearson: 3) according to the available sample volume P we calculate a specially compiled characteristic , where: i, - empirical frequencies, - theoretical frequencies, P - sample size, h- the value of the interval (the difference between two adjacent options), Normalized values of the observed feature, - table function. Also theoretical frequencies can be calculated using the standard MS Excel function NORMDIST according to the formula ; 4) according to the sampling distribution, we determine the critical value of a specially compiled characteristic XL P 5) when hypothesis # 0 is rejected, when hypothesis # 0 is accepted. Example. Consider the sign X- the value of testing indicators for convicts in one of the correctional colonies according to some psychological characteristic, presented as a variation series: At a significance level of 0.05, test the hypothesis of a normal distribution of the general population. 1. Based on the empirical distribution, you can put forward a hypothesis H 0: according to the criterion under study "the value of the test indicator for a given psychological characteristic", the general population the number of children is normally distributed. Alternative Hypothesis 1: according to the studied feature “the value of the test indicator for this psychological characteristic”, the general population of convicts is not normally distributed. 2. Calculate numerical sample characteristics: Intervals x y y X) sch 3. Calculate a specially composed characteristic j 2 . To do this, in the penultimate column of the previous table, we find the theoretical frequencies using the formula, and in the last column let's calculate the characteristic % 2 . We get x 2 = 0,185. For clarity, we will construct a polygon of the empirical distribution and a normal curve according to theoretical frequencies (Fig. 6). Rice. 6. 4. Determine the number of degrees of freedom s: k = 5, t = 2, s = 5-2-1 = 2. According to the table or using the standard MS Excel function "XI20BR" for the number of degrees of freedom 5 = 2 and the significance level a = 0.05 find the critical value of the criterion xl P .=5,99.
For significance level a= 0.01 critical value of the criterion X%. = 9,2. 5. Observed value of the criterion X=0.185 less than all found values Hc R.-> therefore, the hypothesis R 0 is accepted at both significance levels. The discrepancy between the empirical and theoretical frequencies is insignificant. Therefore, the observational data are consistent with the hypothesis of a normal population distribution. Thus, according to the studied feature “the value of the test indicator for this psychological characteristic”, the general population of convicts is distributed normally. Example 1. Using the Pearson test, at a significance level of 0.05, check whether the hypothesis of the normal distribution of the general population X is consistent with the empirical distribution of the sample size n = 200. Decision find with a calculator. . Example 2. Using the Pearson test, at a significance level of 0.05, check whether the hypothesis of the normal distribution of the general population X is consistent with the empirical distribution of the sample size n = 200. Distribution Center Metrics. Let's compare empirical and theoretical frequencies. Let's make a calculation table, from which we will find the observed value of the criterion: Let us define the boundary of the critical region. Since the Pearson statistic measures the difference between the empirical and theoretical distributions, the larger its observed value of K obs, the stronger the argument against the main hypothesis.
Pearson goodness-of-fit test: Statistical test
Goodness-of-fit x 2 Pearson
x i Quantity, fi x i * f i Cumulative frequency, S (x - x sr) * f (x - x sr) 2 * f (x - x sr) 3 * f Frequency, f i /n
5
15
75
15
114.45
873.25
-6662.92
0.075
7
26
182
41
146.38
824.12
-4639.79
0.13
9
25
225
66
90.75
329.42
-1195.8
0.13
11
30
330
96
48.9
79.71
-129.92
0.15
13
26
338
122
9.62
3.56
1.32
0.13
15
21
315
143
49.77
117.95
279.55
0.11
17
24
408
167
104.88
458.33
2002.88
0.12
19
20
380
187
127.4
811.54
5169.5
0.1
21
13
273
200
108.81
910.74
7622.89
0.065
200
2526
800.96
4408.62
2447.7
1
weighted average
Variation indicators.
.
R = X max - X min
R=21 - 5=16
Dispersion
Unbiased estimator of variance
Standard deviation .
Each value of the series differs from the average value of 12.63 by no more than 4.7
.
.
normal law
n = 200, h=2 (interval width), σ = 4.7, xav = 12.63 i x i u i φi n*i
1
5
-1.63
0,1057
9.01
2
7
-1.2
0,1942
16.55
3
9
-0.77
0,2943
25.07
4
11
-0.35
0,3752
31.97
5
13
0.0788
0,3977
33.88
6
15
0.5
0,3503
29.84
7
17
0.93
0,2565
21.85
8
19
1.36
0,1582
13.48
9
21
1.78
0,0804
6.85
i n i n*i n i -n* i (n i -n* i) 2 (n i -n* i) 2 /n* i
1
15
9.01
-5.99
35.94
3.99
2
26
16.55
-9.45
89.39
5.4
3
25
25.07
0.0734
0.00539
0.000215
4
30
31.97
1.97
3.86
0.12
5
26
33.88
7.88
62.14
1.83
6
21
29.84
8.84
78.22
2.62
7
24
21.85
-2.15
4.61
0.21
8
20
13.48
-6.52
42.53
3.16
9
13
6.85
-6.15
37.82
5.52
∑
200
200
22.86
Its boundary K kp = χ 2 (k-r-1;α) is found from the chi-square distribution tables and the given values σ, k = 9, r=2 (the parameters x cp and σ are estimated from the sample).
Kkp(0.05;6) = 12.59159; Kobs = 22.86
The observed value of the Pearson statistics falls into the critical region: Knable > Kkp, so there is reason to reject the main hypothesis. The sample data is distributed not according to normal law. In other words, the empirical and theoretical frequencies differ significantly.
Decision.
Table for calculating indicators.x i Quantity, fi x i * f i Cumulative frequency, S (x - x sr) * f (x - x sr) 2 * f (x - x sr) 3 * f Frequency, f i /n
0.3
6
1.8
6
5.77
5.55
-5.34
0.03
0.5
9
4.5
15
6.86
5.23
-3.98
0.045
0.7
26
18.2
41
14.61
8.21
-4.62
0.13
0.9
25
22.5
66
9.05
3.28
-1.19
0.13
1.1
30
33
96
4.86
0.79
-0.13
0.15
1.3
26
33.8
122
0.99
0.0375
0.00143
0.13
1.5
21
31.5
143
5
1.19
0.28
0.11
1.7
24
40.8
167
10.51
4.6
2.02
0.12
1.9
20
38
187
12.76
8.14
5.19
0.1
2.1
8
16.8
195
6.7
5.62
4.71
0.04
2.3
5
11.5
200
5.19
5.39
5.59
0.025
200
252.4
82.3
48.03
2.54
1
weighted average
Variation indicators.
Absolute Variation Rates.
The range of variation is the difference between the maximum and minimum values of the attribute of the primary series.
R = X max - X min
R = 2.3 - 0.3 = 2
Dispersion- characterizes the measure of spread around its mean value (measure of dispersion, i.e. deviation from the mean).
Unbiased estimator of variance is a consistent estimate of the variance.
Standard deviation.
Each value of the series differs from the average value of 1.26 by no more than 0.49
Estimating the standard deviation.
Testing hypotheses about the type of distribution.
1. Let's test the hypothesis that X is distributed over normal law using Pearson's goodness-of-fit test.
where n* i - theoretical frequencies:
We calculate the theoretical frequencies, given that:
n = 200, h=0.2 (interval width), σ = 0.49, xav = 1.26 i x i u i φi n*i
1
0.3
-1.96
0,0573
4.68
2
0.5
-1.55
0,1182
9.65
3
0.7
-1.15
0,2059
16.81
4
0.9
-0.74
0,3034
24.76
5
1.1
-0.33
0,3765
30.73
6
1.3
0.0775
0,3977
32.46
7
1.5
0.49
0,3538
28.88
8
1.7
0.89
0,2661
21.72
9
1.9
1.3
0,1691
13.8
10
2.1
1.71
0,0909
7.42
11
2.3
2.12
0,0422
3.44
21.72
-2.28
5.2
0.24
9
20
13.8
-6.2
38.41
2.78
10
8
7.42
-0.58
0.34
0.0454
11
5
3.44
-1.56
2.42
0.7
∑
200
200
12.67
Therefore, the critical region for this statistic is always right-handed :)