Testing the hypothesis of a normal distribution. Pearson's criterion for testing the hypothesis about the form of the distribution law of a random variable

Objective 1.

Using Pearson's test, at a significance level a= 0.05 check if the hypothesis of the normal distribution of the general population is consistent X with empirical distribution of sample size n = 200.

Solution.

1. Let's calculate and sample mean standard deviation .
2. Let us calculate the theoretical frequencies taking into account that n = 200, h= 2, = 4.695, according to the formula
.

Let's compose a calculation table (the values ​​of the function j(x) are given in Appendix 1).


i

3. Let's compare empirical and theoretical frequencies. Let's compose a calculation table from which we find the observed value of the criterion :


i
Sum

According to the table of critical distribution points (Appendix 6), according to the level of significance a= 0.05 and the number of degrees of freedom k = s- 3 = 9 - 3 = 6 we find the critical point of the right-side critical region (0.05; 6) = 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 range of roll diameters

i

xi, mm

xi, mm

Required:

1) compose a discrete variation 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 of the empirical and theoretical distributions according to the Pearson criterion. When testing the statistical hypothesis about the type of distribution, take the significance level a = 0.05

Solution: The main numerical characteristics of this variation series find by definition. The average roll diameter is (mm):
x cf = = 6.753;
corrected variance (mm2):
D = = 0,0009166;
corrected root mean square (standard) deviation (mm):
s = = 0,03028.


Rice. Frequency distribution of roll diameters

The original ("raw") frequency distribution of the variation series, i.e. conformity ni(xi), is characterized by a rather large scatter of values ni relative to some hypothetical "averaging" curve (Fig.). In this case, it is preferable to construct and analyze the interval variation series by combining the frequencies for diameters falling within the appropriate 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 × log200 = 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 range of roll diameters.

k

xk, mm

The interval series can be visualized as a histogram of the frequency distribution.


Rice... Frequency distribution of roll diameters. The solid line is the smoothing normal curve.

The form of the histogram allows us to make the assumption that the distribution of the 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 determined by the expression:
N(a; s; xk) = .
In these expressions xk- centers of intervals in a frequency interval variation series.

For instance, x 1 = (6.68 + 6.70) / 2 = 6.69. As center ratings a and the parameter s of the Gaussian curve can be taken:
a = x Wed
From fig. it can be seen that the Gaussian normal distribution as a whole corresponds to the empirical interval distribution. However, you should make sure that statistical significance this correspondence. We use to check the correspondence of the empirical distribution to the empirical criterion of goodness of Pearson c2. For this, the empirical value of the criterion should be calculated as the sum
= ,
where nk and nk, theor - 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 according to 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 - 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). In this way, d.f... = 5. The critical value of Pearson's criterion is crit (a; d.f.) = 11.1. Since c2mp< c2крит, заключаем, что согласие между эмпирическим и теоретическим нормальным распределением является статистическим значимым. Иными словами, теоретическое normal distribution describes the empirical data satisfactorily.

Task3

Chocolate boxes are packed automatically. According to the scheme of proper random non-repetitive sampling, 130 out of 2000 packages contained in the batch were taken, and the following data on their weight was obtained:

It is required using the Pearson criterion at a significance level of a = 0.05 to test the hypothesis that the random variable X - the weight of the packages - is distributed according to the normal law. Plot the empirical distribution histogram and the corresponding normal curve on one graph.

Solution

1012,5
= 615,3846

Note:

In principle, the corrected sample variance should be taken as the variance of the normal distribution law. But since the number of observations - 130 is large enough, then “usual” will do.
Thus, the theoretical normal distribution is:

Interval

[xi; xi + 1]

Empirical frequencies

ni

Probabilities
pi

Theoretical frequencies
npi

(ni-npi) 2

Def The criterion for testing the hypothesis about the assumed law of the unknown distribution is called the goodness-of-fit test.

There are several goodness-of-fit criteria: $ \ chi ^ 2 $ (chi-square) by K. Pearson, Kolmogorov, Smirnov, etc.

Usually the theoretical and empirical frequencies are different. The case of discrepancy may not be accidental, which means it is explained by the fact that the hypothesis was not correctly chosen. Pearson's criterion answers the question posed, but like any criterion, it does not prove anything, but only establishes at the accepted level of significance its agreement or disagreement with the observational data.

Def A sufficiently small probability at which an event can be considered practically impossible is called the level of significance.

In practice, significance levels are usually taken between 0.01 and 0.05, $ \ alpha = 0.05 $ - this is 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 distribution law of the random variable (1), regardless of the law according to which the general population is distributed, tends to the $ \ chi ^ 2 $ (chi-square) law with $ k $ degrees of freedom.

Def The number of degrees of freedom is found by the equality $ k = S-1-r $ where $ S- $ is the number of groups of intervals, $ r- $ is the number of parameters.

1) even distribution: $ r = 2, k = S-3 $

2) normal distribution: $ r = 2, k = S-3 $

3) exponential distribution: $ r = 1, k = S-2 $.

The rule ... Hypothesis testing by Pearson's criterion.

  1. To test the hypothesis, calculate the theoretical frequencies and find $ \ chi _ (obs) ^ 2 = \ sum (\ frac (((n_i -n_i ")) ^ 2) (n_i")) $
  2. From the table of critical points of the distribution $ \ chi ^ 2 $ for a given level of significance $ \ alpha $ and the number of degrees of freedom $ k $, $ \ chi _ (cr) ^ 2 ((\ alpha, k)) $ is found.
  3. If $ \ chi _ (obs) ^ 2<\chi _ { кр } ^2 $ то нет оснований отвергать гипотезу, если не выполняется данное условие - то отвергают.

Comment To control the calculations, use the formula for $ \ chi ^ 2 $ in the form $ \ chi _ (obs) ^ 2 = \ sum (\ frac (n_i ^ 2) (n_i ") -n) $

Testing the Uniform Distribution Hypothesis

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 $ \ alpha $, it is required:

1) Find, for a given empirical distribution, the sample mean $ \ overline (x_b) $ and $ \ sigma _b = \ sqrt (D_b) $. Take as estimates of the parameters $ a $ and $ b $ the values

$ a = \ overline x _b - \ sqrt 3 \ sigma _b $, $ b = \ overline x _b + \ sqrt 3 \ sigma _b $

2) Find the probability of the random variable $ X $ falling into the partial intervals $ ((x_i, x_ (i + 1))) $ by the formula $ P_i = P ((x_i

3) Find theoretical (equalizing) frequencies by the formula $ n_i "= np_i $.

4) Taking the number of degrees of freedom $ k = S-3 $ and the significance level $ \ alpha = 0.05 $ according to the tables $ \ chi ^ 2 $, we find $ \ chi _ (cr) ^ 2 $ for 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 - $ empirical frequencies, we find the observed value $ \ chi _ (obs) ^ 2 $.

6) If $ \ chi _ (obs) ^ 2<\chi _ { кр } ^2 -$ нет оснований, отвергать гипотезу.

Let's check the hypothesis with 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 interval length is the same, then the $ 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 enter all the obtained values ​​into 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.56562 & 2, 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.

Statistical test

The rule according to 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 designates a specially compiled characteristic from clause 2 of the statistical hypothesis testing algorithm (see clause 4.1), calculated in the criterion. Under the conditions of this algorithm, the criterion would be called "v-criterion".

When testing statistical hypotheses, two types of errors are possible:

  • - error of the first kind(you can reject the hypothesis I 0 when it is actually true);
  • - error of the second kind(you can accept the hypothesis I 0 when it is actually not true).

Probability a to make a mistake of the first kind is called the level of significance of the criterion.

If for R denote the probability of making an error of the second kind, then (l - R) - the probability of avoiding an error of the second kind, which is called power of the criterion.

Goodness of fit x 2 Pearson

There are several types of statistical hypotheses:

  • - about the law of distribution;
  • - uniformity of samples;
  • - numerical values ​​of distribution parameters, etc.

We will consider the hypothesis of the distribution law using the example of Pearson's x 2 goodness-of-fit test.

The criterion of consent is called the statistical criterion for testing the null hypothesis about the assumed law of the unknown distribution.

Pearson's goodness-of-fit test is based on a comparison of empirical (observed) and theoretical observation frequencies calculated under the assumption of a certain distribution law. Hypothesis # 0 is formulated here as follows: the general population is normally distributed according to the attribute under study.

Algorithm for testing statistical hypothesis # 0 for the criterion x 1 Pearson:

  • 1) we put forward the hypothesis I 0 - according to the studied attribute, the general population is distributed normally;
  • 2) calculate the sample mean and sample standard deviation O v;

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 size of the interval (the difference between two adjacent options),

Normalized values ​​of the observed characteristic,

- table function. Also theoretical frequencies

can be calculated using the standard MS Excel function NORMDIST according to the formula;

4) according to the sample 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 the indicators of testing convicts in one of the correctional colonies for some psychological characteristics, presented in the form of a variation series:

At a significance level of 0.05, test the hypothesis of the normal distribution of the general population.

1. Based on the empirical distribution, you can put forward a hypothesis H 0: according to the studied attribute "the value of the test indicator for a given psychological characteristic" the general population was

the expected ones are distributed normally. Alternative hypothesis 1: the general population of convicts is not normally distributed according to the studied attribute “the value of the test indicator for a given psychological characteristic”.

2. Let's calculate the numerical sample characteristics:

Intervals

x g u

X) SCH

3. Let's calculate the specially compiled characteristic j 2. To do this, in the penultimate column of the previous table, we find the theoretical frequencies by the formula, and in the last column

let's calculate the characteristic% 2. We get x 2 = 0,185.

For clarity, we will construct an empirical distribution polygon and a normal curve for theoretical frequencies (Fig. 6).

Rice. 6.

4. Determine the number of degrees of freedom s: k = 5, m = 2, s = 5-2-1 = 2.

According to the table or using the standard MS Excel function "HI20BR" for the number of degrees of freedom 5 = 2 and the level of significance a = 0.05 find the critical value of the criterion xl P.=5,99. For the significance level a= 0.01 critical criterion value X%. = 9,2.

5. Observed value of the criterion X= 0.185 less than all found values Hk R.-> therefore, the hypothesis I 0 is accepted at both levels of significance. The discrepancy between empirical and theoretical frequencies is insignificant. Consequently, the observational data are consistent with the hypothesis of a normal distribution of the general population. Thus, according to the studied criterion "the value of the test indicator for a given psychological characteristic", the general population of convicts is distributed normally.

  • 1. Koryachko A.V., Kulichenko A.G. Higher mathematics and mathematical methods in psychology: a guide to practical exercises for students of the Faculty of Psychology. Ryazan, 1994.
  • 2. Heritage AD Mathematical methods of psychological research. Analysis and interpretation of data: Textbook, manual. SPb., 2008.
  • 3. Sidorenko E.V. Methods of mathematical processing in psychology. SPb., 2010.
  • 4. Soshnikova L.A. and other Multivariate statistical analysis in economics: Textbook, manual for universities. M., 1999.
  • 5. Sukhodolskiy E.V. Mathematical methods in psychology. Kharkov, 2004.
  • 6. Shmoilova R.A., Minashkin V.E., Sadovnikova N.A. Workshop on the theory of statistics: Textbook, manual. M., 2009.
  • Gmurman V.E. Theory of Probability and Mathematical Statistics. P. 465.
Pearson's goodness-of-fit test:

Example 1... Using Pearson's 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.

Solution find with a calculator.

x iQuantity, f ix i * f iAccumulated frequency, S(x - x cf) * f(x - x cf) 2 * f(x - x avg) 3 * fFrequency, 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 variance estimate


Standard deviation.

Each value of the series differs from the average value 12.63 by no more than 4.7
.

.
normal law




n = 200, h = 2 (interval width), σ = 4.7, x avg = 12.63

ix iu iφ in * 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
in in * in 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



We find its boundary K kp = χ 2 (k-r-1; α) from the tables of the chi-square distribution and the given values ​​σ, k = 9, r = 2 (the parameters x cp and σ are estimated from the sample).
Kkp (0.05; 6) = 12.59159; Kobl = 22.86
The observed value of Pearson's statistics falls into the critical region: Knabl> Kkp, so there is reason to reject the main hypothesis. Sample data distributed not according to the normal law... In other words, the empirical and theoretical frequencies differ significantly.

Example 2... Using Pearson's 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.
Solution.
Table for calculating indicators.

x iQuantity, f ix i * f iAccumulated frequency, S(x - x cf) * f(x - x cf) 2 * f(x - x avg) 3 * fFrequency, 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

Distribution center indicators.
Weighted average


Variation indicators.
Absolute indicators of variation.
The range of variation is the difference between the maximum and minimum values ​​of the primary series feature.
R = X max - X min
R = 2.3 - 0.3 = 2
Dispersion- characterizes the measure of dispersion around its mean (the measure of dispersion, i.e. deviation from the mean).


Unbiased variance estimate- consistent estimate of variance.


Standard deviation.

Each value of the series differs from the average value 1.26 by no more than 0.49
Estimation of standard deviation.

Testing hypotheses about the type of distribution.
1. Let us check the hypothesis that X is distributed over normal law using Pearson's goodness-of-fit test.

where n * i - theoretical frequencies:

Let's calculate the theoretical frequencies, taking into account that:
n = 200, h = 0.2 (interval width), σ = 0.49, x avg = 1.26

ix iu iφ in * 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

Let's compare empirical and theoretical frequencies. Let's compose a calculation table from which we find the observed value of the criterion:

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

Let us define the boundary of the critical region. Since Pearson's statistics measure the difference between empirical and theoretical distributions, the larger its observed value K obs, the stronger the argument against the main hypothesis.
Therefore, the critical area for this statistic is always right-handed :)