{"id":376478,"date":"2024-05-21T06:52:08","date_gmt":"2024-05-21T06:52:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=376478"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=376478","title":{"rendered":"<span>\u0420\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u044f\u0442\u044c\u044e \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/192000\/\" rel=\"noopener noreferrer nofollow\">\u0412\u043e\u0442 \u0442\u0443\u0442<\/a> \u0443\u0432. <a class=\"mention\" href=\"\/users\/dimview\">@dimview<\/a> \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445 \u0438 \u0421\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0437\u0430 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f \u0440\u0435\u0448\u0430\u044f \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0418 \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 100500 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f (\u043d\u0435)\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b. <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u044f\u0434 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f\u043e\u043c. \u0418\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0438\u0445 &#171;\u0440\u0443\u0447\u043d\u043e\u0439&#187; \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy.stats. \u0412 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435, \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0442.\u043a. \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0438 \u0443\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u0421\u0430\u043c\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a: <em>&#171;\u0418 \u0432\u043e\u0442 \u0441\u0432\u0435\u0436\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u2014 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 893 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0443 \u043d\u0430\u0441 \u0447\u0442\u043e-\u0442\u043e \u043a\u0443\u043f\u0438\u043b\u0438 34, \u0430 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 923 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0447\u0442\u043e-\u0442\u043e \u043a\u0443\u043f\u0438\u043b\u0438 28. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0438\u0434\u0442\u0438 \u043a \u043d\u0430\u0447\u0430\u043b\u044c\u0441\u0442\u0432\u0443 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u00ab\u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f 3.81%, \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 3.03%, \u043d\u0430\u043b\u0438\u0446\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 26%, \u0433\u0434\u0435 \u043c\u043e\u044f \u043f\u0440\u0435\u043c\u0438\u044f?\u00bb \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 6 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 \u0435\u0449\u0451 \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430?&#187;<\/em><\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0440\u0435\u043c\u0430\u0440\u043a\u0430 \u043e  p-value \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430\u0445 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c. <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u044b \u0438\u0441\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u043c\u0438 p-value (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/P-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u043a\u0438<\/a>) \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430. \u041d\u043e \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0442\u0435\u0441\u0442 \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043a. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437 893\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 34 \u043f\u0440\u043e\u0434\u0430\u0436\u0438, \u0432 &#171;\u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0439&#187; &#8212; 37, \u0435\u0449\u0435 \u0432 \u043e\u0434\u043d\u043e\u0439 &#8212; 28 \u0438 \u0442.\u0434.. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 923 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439 (\u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0434\u0430\u0436\/\u043e\u0431\u044a\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438). \u0418 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0440\u0430\u0437\u043d\u0438\u0446. <\/p>\n<p>p-value = 0.05 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 5% \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043d\u0438\u0446. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e <em>\u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e<\/em> \u0440\u0430\u0437\u043d\u0438\u0446\u0443 <em>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e <\/em>\u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 0.05. \u0418 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0447\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439. \u0415\u0441\u043b\u0438 \u0436\u0435 p-value = 0.35, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e &#8212; \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e. \u0418 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043b\u0443\u0447\u0448\u0435. \u0412 \u0446\u0435\u043b\u043e\u043c \u0436\u0435 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0432\u0435\u0440\u0438\u044f \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0438.<\/p>\n<p>\u041a\u0430\u0441\u0430\u0435\u043c\u043e \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c 95% \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 95% \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 \u043d\u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439, \u0442\u043e \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b 0 (\u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c). \u0418\u043d\u0430\u0447\u0435 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 &#8212; \u0432\u044b\u0441\u043e\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0447\u0442\u043e \u043d\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u043e\u0434\u043d\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435. \u0418 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. <\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 <\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 &#8212; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043a\u0430\u043a 1, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u043a 0. \u0418 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 (\u0442.\u0435. \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439). \u0418 \u043f\u0435\u0440\u0432\u043e\u0435, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u043c &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0443\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0439 t-\u0442\u0435\u0441\u0442.<\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0434\u0430\u0436 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; k1 (=34), \u0430 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 n1 (=893). \u0418 k2, n2 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b k1\/n1 &#8212; k2\/n2 \u0435\u0441\u043b\u0438 \u0431\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0438\u0440\u0430\u0445. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f: n1 \u0438 n2 \u0431\u044b\u043b\u0438 \u0431\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0430 k1 + k2 = const. \u041a\u0430\u043a \u0440\u0430\u0437 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 t-test \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy.stats \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c p-value.<\/p>\n<pre><code>import scipy.stats as ss #\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0431\u044b\u0440\u043e\u043a\u0430 n1 = 893 k1 = 34 #\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 n2 = 923 k2 = 28  s1 = np.zeros(n1) s1[:k1] = 1 s2 = np.zeros(n2) s2[:k2] = 1 ss.ttest_ind(s1,s2) #>>TtestResult(statistic=0.9075373501154826, pvalue=0.36424324967099464, df=1814.0)  #s1 \u0438 s2 - \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 1 - \u043f\u0440\u043e\u0434\u0430\u0436 #\u0438 0 - \u0438\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f. \u042d\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0438 \u043d\u0430 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f\u0435. print(s1[:70]) #>>[1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.  1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.  0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]<\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d t-test. \u041c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 (\u0434\u0432\u0443\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0439 t-\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439).<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0438\u0445 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"D(\\xi+\\mu)=D\\xi+D\\mu\" alt=\"D(\\xi+\\mu)=D\\xi+D\\mu\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/139\/170\/891\/13917089184c69a569aa6e20066e28d4.svg\" width=\"176\" height=\"22\"\/>). \u041f\u043e\u0434\u0435\u043b\u0438\u0432 \u043d\u0430\u0448\u0443 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"t=\\frac{ \\overline{x_1}-\\overline{x_2} } { \\sqrt{ \\frac{D_1}{n_1}+\\frac{D_2}{n_2}} }\" alt=\"t=\\frac{ \\overline{x_1}-\\overline{x_2} } { \\sqrt{ \\frac{D_1}{n_1}+\\frac{D_2}{n_2}} }\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/313\/e45\/f0b\/313e45f0b100bd34510e0a5f29674da5.svg\" width=\"131\" height=\"67\"\/><\/p>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b df = n1+n2-2.<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0430) \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043b\u0438 \u0441\u0445\u043e\u0436\u0443\u044e \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u0431) \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 <em>\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/em> \u0431\u044b\u043b\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0433\u0430\u0443\u0441\u0441\u043e\u0432\u043e, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0445\u0432\u043e\u0441\u0442\u044b \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u0443\u044e \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435. \u041f\u0440\u0438 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 (\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u0438\u0445 \u0443 \u043d\u0430\u0441 \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e).<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c t-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0430 \u0438\u0437-\u0437\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0438, \u0430 \u043d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0432 \u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u043d\u0435\u0441\u043c\u0435\u0449\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438<\/p>\n<pre><code>d1 = k1\/(n1-1)*(1-k1\/n1) d2 = k2\/(n2-1)*(1-k2\/n2) D = d1+d2  m = k1\/n1 - k2\/n2 std = np.sqrt( d1\/n1 + d2\/n2 ) t = m\/std print('t-value: ',t) df = n1+n2-2 print('p-value: ',1 - ss.t.cdf(t, df) ) >>t-value:  0.905901136585428 >>p-value:  0.18255424508928209  # \u041d\u0430\u0448\u0435 p-value \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0447\u0442\u0438 \u0432 2 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0438\u0437 \u0442\u0435\u0441\u0442\u0430. # \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b\u0438 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.  # \u0414\u043b\u044f \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0448\u0442\u0443\u043a\u0443: print('two-side p-value: ',ss.t.cdf(-t, df) + 1 - ss.t.cdf(t, df) ) >>two-side p-value:  0.36510849017856417  #\u0418\u043b\u0438 \u043d\u0435\u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u043e \u0434\u043e\u043c\u0436\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 2, \u0442.\u043a. \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435  print('two-side p-value: ', (1 - ss.t.cdf(t, df))*2 ) two-side p-value:  0.36510849017856417  #\u041d\u0443 \u0438 \u0440\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c print('two-side p-value: ', (1 - ss.norm.cdf(m, scale=std) )*2 ) >>two-side p-value:  0.3649881826944741<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f p-value \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 4\u043c \u0437\u043d\u0430\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b \u043e\u0447. \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0430\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c. \u0415\u0449\u0435 \u0443 \u0442\u0435\u0441\u0442\u0430 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0435 t-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043e\u0447\u0435\u043c\u0443).<\/p>\n<pre><code># \u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b 95% \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 print(f'{ss.t.ppf(.025,df,loc=m,scale=std)*100:.3f}%; {ss.t.ppf(.975,df,loc=m,scale=std)*100:.3f}%') >>-0.901%; 2.449%  # \u0418 \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e print(f'{ss.norm.ppf(.025,loc=m,scale=std)*100:.3f}%; {ss.norm.ppf(.975,loc=m,scale=std)*100:.3f}%') >>-0.900%; 2.448%<\/code><\/pre>\n<h3>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439  <\/h3>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u0430\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0443\u044e \u043c\u043e\u043d\u0435\u0442\u043a\u0443. \u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u041f\u0438\u0440\u0441\u043e\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\chi^2 = \\sum \\frac{(O-E)^2}{E}\" alt=\"\\chi^2 = \\sum \\frac{(O-E)^2}{E}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5ea\/7b7\/95d\/5ea7b795de93b3ea1e125da3bb242efc.svg\" width=\"161\" height=\"46\"\/>, \u0433\u0434\u0435 O \u0438 E &#8212; observed and expected \u0447\u0430\u0441\u0442\u043e\u0442\u044b. \u0418 \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\chi^2\" alt=\"\\chi^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/420\/797\/0e7\/4207970e70ceb3219b1c97393b834f8e.svg\" width=\"21\" height=\"24\"\/> \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043c\u043e\u043d\u0435\u0442\u043a\u0443 60 \u0440\u0430\u0437. \u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c (expect), \u0447\u0442\u043e \u043e\u0440\u0435\u043b \u0432\u044b\u043f\u0430\u0434\u0435\u0442 30 \u0440\u0430\u0437, 60-30 &#8212; \u0432\u044b\u043f\u0430\u0434\u0435\u0442 \u0440\u0435\u0448\u043a\u0430.<\/p>\n<p>\u0410 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c (observe)  20 \u0440\u0435\u0448\u0435\u043a \u0438 40 \u043e\u0440\u043b\u043e\u0432. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c E(\u043e\u0440\u043b\u0430)=\u0415(\u0440\u0435\u0448\u043a\u0430)=30. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u041e(\u0440\u0435\u0448\u043a\u0430)=20, \u041e(\u043e\u0440\u043b\u0430)=40.<\/p>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\chi^2 = \\left(\\frac{20-30}{\\sqrt{30}}\\right)^2+\\left(\\frac{40-30}{\\sqrt{30}}\\right)^2\" alt=\"\\chi^2 = \\left(\\frac{20-30}{\\sqrt{30}}\\right)^2+\\left(\\frac{40-30}{\\sqrt{30}}\\right)^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/370\/0a3\/197\/3700a31979cb5cae10e26f9c78fcd1f5.svg\" width=\"283\" height=\"54\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438. \u041a\u0430\u043a\u043e\u0432\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b, \u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430 (\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H_0\" alt=\"H_0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/80d\/d9b\/9d1\/80dd9b9d1ed247a2a6beb496269ca122.svg\" width=\"25\" height=\"20\"\/> &#8212; \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443)? \u041f\u043e\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>R\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b:<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"df = (m-1)(n-1)\" alt=\"df = (m-1)(n-1)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6a0\/4cc\/b4d\/6a04ccb4d4776d9be89cde80fffa7464.svg\" width=\"171\" height=\"22\"\/> <br \/>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0432\u043d\u043e (2-1)(2-1) = 2<\/p>\n<pre><code># \u041d\u0430\u0439\u0434\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435. # \u041c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 # \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 # \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u0447\u0430\u0442\u043e\u0442\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430. total_mean = (k1+k2)\/(n1+n2)  #\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u044b \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 #\u0431\u044b\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0434\u0438\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 k1_e = n1*total_mean k2_e = n2*total_mean print(f'k1 expected = {k1_e:.1f}; k2 expected = {k2_e:.1f}') #>>k1 expected = 30.5; k2 expected = 31.5  #\u042d\u0442\u043e \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442 \"\u043f\u0440\u043e\u043c\u0430\u0445\u043e\u0432\" t1 = n1 - k1 t2 = n2 - k2  t1_e = n1*(t1+t2)\/(n1+n2) t2_e = n2*(t1+t2)\/(n1+n2)  #\u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 1 - total_mean #\u0432\u043c\u0435\u0441\u0442\u043e (t1+t2)\/(n1+n2)  print(f't1 expected = {t1_e:.1f}; t2 expected = {t2_e:.1f}') #>>t1 expected = 862.5; t2 expected = 891.5  O = np.array([k1,k2,t1,t2]) E = np.array([k1_e,k2_e,t1_e,t2_e])  chi2 = sum( (O-E)**2\/E ) print('\u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 chi2: ',chi2) #>>\u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 chi2:  0.8241579182647449  print(f'p-value: {1 - ss.chi2(1).cdf(chi2):.3f}', ) #>>p-value: 0.364<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0443\u0442 \u043d\u0430 2 \u043d\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c, \u0442.\u043a. \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0438 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0435. \u041d\u0443 \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u043c <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\chi^2\" alt=\"\\chi^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3bf\/60f\/2cb\/3bf60f2cb9f22d3a63c17f08271a2242.svg\" width=\"21\" height=\"24\"\/> \u0438\u0437 scipy<\/p>\n<pre><code>#\u0422\u0443\u0442 \u043c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0443 \u0419\u0435\u0439\u0442\u0441\u0430 res = ss.chi2_contingency( [[k1,k2],[n1-k1,n2-k2]], correction=False) print(f'\u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u04382: {res.statistic:.3f}') #>>\u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u04382: 0.824  print(f'p-value: {res.pvalue:.3f}') #>>p-value: 0.364<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u044e\u0442 \u0441 \u0442\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0434\u043b\u044f t-\u0442\u0435\u0441\u0442\u0430. \u0427\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f\u00a0<a href=\"https:\/\/stats.stackexchange.com\/questions\/173415\/at-what-level-is-a-chi2-test-mathematically-identical-to-a-z-test-of-propo\" rel=\"noopener noreferrer nofollow\"><u>\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c<\/u><\/a>\u00a0\u044d\u0442\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 2\u04452. <\/p>\n<h3>ANOVA  <\/h3>\n<p><strong>\u041e\u0434\u043d\u043e\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437.<\/strong><\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438  \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c &#8212; \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0445\u04382 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 anova \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0439 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, F-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>Anova \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442. \u0415\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f \u0442\u0430\u043a \u0438 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 (\u0432\u043d\u0443\u0442\u0440\u0438\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0438 \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438). \u041d\u0430 \u0446\u0438\u0444\u0440\u0430\u0445 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"x_i^j\" alt=\"x_i^j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4d7\/3a9\/aba\/4d73a9ababbb3d4c06f7152ae745ef13.svg\" width=\"19\" height=\"28\"\/>, \u0433\u0434\u0435 j=1..M &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u043f\u043f (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 2), \u0430 i=1..N &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 893 \u0438 923).<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0431\u0449\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\" \\bar{\\bar{x}} =\\frac{1}{MN} \\sum_{i,j}  x_i^j \" alt=\" \\bar{\\bar{x}} =\\frac{1}{MN} \\sum_{i,j}  x_i^j \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0c8\/484\/86d\/0c848486d7733266de2fb9c958f28024.svg\" width=\"134\" height=\"54\"\/><\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043c \u043e\u0431\u0449\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"SST = \\sum_{i,j} (x_i^j-\\bar{\\bar{x}})^2\" alt=\"SST = \\sum_{i,j} (x_i^j-\\bar{\\bar{x}})^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2be\/3bd\/a12\/2be3bda126ae52936751588922f82c28.svg\" width=\"169\" height=\"47\"\/><\/p>\n<p>SST \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"SST=SSW+SSB\" alt=\"SST=SSW+SSB\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e7c\/8b5\/dda\/e7c8b5dda6ca3fac939893d196e27569.svg\" width=\"172\" height=\"18\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c <strong> \u0432\u043d\u0443\u0442\u0440\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e <\/strong> \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"SSW = \\sum_j \\sum_i(x_i^j-\\bar{x}^j)^2\" alt=\"SSW = \\sum_j \\sum_i(x_i^j-\\bar{x}^j)^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/182\/585\/606\/182585606a52ff9c39b5c935c86e31a0.svg\" width=\"214\" height=\"47\"\/><\/p>\n<p>\u0422.\u0435. \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"{x}^j\" alt=\"{x}^j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/314\/c8b\/b1d\/314c8bb1d496556c4c51d84a954d026a.svg\" width=\"19\" height=\"20\"\/>. <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"df = N\\cdot M-M\" alt=\"df = N\\cdot M-M\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/076\/d25\/23f\/076d2523f300f7aceed475851b5a7986.svg\" width=\"142\" height=\"20\"\/> . \u0422.\u0435. \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0438\u043d\u0443\u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u043f\u043f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <strong> \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443 <\/strong> \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"SSB = \\sum_j N_j( \\bar{x}^j-\\bar{\\bar{x}} )^2\" alt=\"SSB = \\sum_j N_j( \\bar{x}^j-\\bar{\\bar{x}} )^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1e\/9fc\/4cc\/e1e9fc4ccc1459ac556c9ada67f6fc75.svg\" width=\"196\" height=\"47\"\/><\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0434\u043e\u043c\u043d\u043e\u0436\u0438\u043b\u0438 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"N_j\" alt=\"N_j\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0f0\/018\/167\/0f0018167d66fabde0c4ae7da7289726.svg\" width=\"23\" height=\"22\"\/>). \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"df = M-1\" alt=\"df = M-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/82d\/5fa\/d4e\/82d5fad4e4420a48e19d5ef168809435.svg\" width=\"100\" height=\"20\"\/>. \u0422\u0443\u0442 \u0432\u0440\u043e\u0434\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e &#8212; \u0437\u043d\u0430\u0435\u043c \u043e\u0431\u0449\u0435\u0433\u0443\u043f\u043f\u043e\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0438 \u043f\u0430\u0440\u0443 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 &#8212; \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c F \u0437\u043d\u0430\u0447\u0430\u0435\u043d\u0438\u0435 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"F = \\tfrac{ \\dfrac{SSB}{M-1} }{ \\dfrac{SSW}{N\\cdot M-M} }\" alt=\"F = \\tfrac{ \\dfrac{SSB}{M-1} }{ \\dfrac{SSW}{N\\cdot M-M} }\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6cf\/867\/887\/6cf86788781a722af0c5711103be9604.svg\" width=\"149\" height=\"92\"\/><\/p>\n<p>\u0422.\u0435. \u0442\u0443\u0442 \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u043a \u0432\u043d\u0443\u0442\u0440\u0438\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0439. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044f \u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u043d\u0443\u0442\u0440\u0438\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b \u0438 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 \u043d\u0435\u0432\u0435\u0440\u043d\u0430.<\/p>\n<pre><code>mean1 = k1\/n1 mean2 = k2\/n2 total_mean = (k1+k2)\/(n1+n2)  ssw = k1*(1-mean1)**2 + (n1-k1)*mean1**2 + k2*(1-mean2)**2 + (n2-k2)*mean2**2 df_ssw = n1+n2-2  ssb = n1*(mean1-total_mean)**2 + n2*(mean2-total_mean)**2 df_ssb = 2 - 1  F = ssb\/df_ssb \/ (ssw\/df_ssw) print('F-value: ',F ) #>>F-value:  0.8236240418546322  print('P-value: ',1 - ss.f.cdf(F,df_ssb,df_ssw) ) #>>P-value:  0.36424324967094446<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0440\u043e\u0432\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 p-value.<\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u03c7\u00b2 anova \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0442.\u0435. \u0435\u043c\u0443 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c). \u0418 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 t-\u0442\u0435\u0441\u0442\u0430.<\/p>\n<p>\u041f\u0440\u043e \u03c7\u00b2 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/companies\/mygames\/articles\/677074\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>.<\/p>\n<h3>\u0422\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0424\u0438\u0448\u0435\u0440\u0430 <\/h3>\n<p>\u0422\u043e\u0447\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0424\u0438\u0448\u0435\u0440\u0430 \u043a\u0430\u043a \u0431\u044b &#171;\u0432 \u043b\u043e\u0431&#187; \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0434\u0432\u044b\u0431\u043e\u0440\u043a\u0438 (k1,n1) \u0438 \u0438 (k2,n2) \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438.<br \/> \u0422.\u0435. \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c k1+k2 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u0432 N = n1+n2 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f\u0445.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"\\begin{matrix}{}    k_1   &amp; k_2   &amp; k_1 + k_2\\\\    \\nu_1 &amp; \\nu_2 &amp; \\nu_1+\\nu_2\\\\    n_1   &amp; n_2   &amp; N\\end{matrix}\" alt=\"\\begin{matrix}{}    k_1   &amp; k_2   &amp; k_1 + k_2\\\\    \\nu_1 &amp; \\nu_2 &amp; \\nu_1+\\nu_2\\\\    n_1   &amp; n_2   &amp; N\\end{matrix}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c4f\/2df\/212\/c4f2df212b9f694dfe4ce6ac52c094b9.svg\" width=\"146\" height=\"76\"\/><\/p>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439. \u0422.\u0435. \u0443 \u043d\u0430\u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445\/\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0435\u0441\u0442\u0435 (<img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\nu_{1,2} = n_{1,2} - k_{1,2}\" alt=\"\\nu_{1,2} = n_{1,2} - k_{1,2}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb6\/54f\/a34\/cb654fa34816ea027982bbb0d04e5aad.svg\" width=\"139\" height=\"22\"\/>) \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 (\u043f\u043e\u043a\u0430\u0437\u043e\u0432).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"H_0\" alt=\"H_0\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f8a\/665\/414\/f8a665414f3fd2351a7133ca356d5653.svg\" width=\"25\" height=\"20\"\/> \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430 \u0438 \u0440\u0430\u0432\u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e8\/c9e\/a03\/6e8c9ea03dbf2c19fc0ee9be3a827048.svg\" width=\"10\" height=\"15\"\/>.<\/p>\n<p><strong> \u041f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 <\/strong><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0448 &#171;\u043f\u0440\u043e\u0446\u0435\u0441\u0441&#187; \u043a\u0430\u043a \u0440\u044f\u0434 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<p>\u0421\u043e\u0431\u044b\u0442\u0438\u0435 <strong>\u0421<\/strong>: \u041a \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u0438 N=n1+n2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 k1+k2 \u0438\u0437 \u043d\u0438\u0445 \u0443 \u043d\u0430\u0441 \u0447\u0442\u043e-\u0442\u043e \u043a\u0443\u043f\u0438\u043b\u0438. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"C_N^{k_1+k_2}p^{k_1+k_2}(1-p)^{N}\" alt=\"C_N^{k_1+k_2}p^{k_1+k_2}(1-p)^{N}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d1\/f36\/5ec\/9d1f365ec5d6e4e997706fd857a0cf14.svg\" width=\"175\" height=\"28\"\/>. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c &#8212; \u044d\u0442\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u0438\u0437 \u0411\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0434\u0430\u0436\u0438 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a3\/fde\/ca8\/8a3fdeca829a46f293358f969e38de08.svg\" width=\"10\" height=\"15\"\/>.<\/p>\n<p>\u0421\u043e\u0431\u044b\u0442\u0438\u0435 <strong>\u0410<\/strong>: \u0412 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0431\u044b\u043b\u043e k1 \u043f\u0440\u043e\u0434\u0430\u0436 \u0438\u0437 n1 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"\\frac{n_1!}{k_1!(n_1-k_1)!}p^{k_1}(1-p)^{\\nu_1} = C_{n_1}^{k_1}p^{k_1}(1-p)^{\\nu_1}\" alt=\"\\frac{n_1!}{k_1!(n_1-k_1)!}p^{k_1}(1-p)^{\\nu_1} = C_{n_1}^{k_1}p^{k_1}(1-p)^{\\nu_1}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4f2\/ac5\/c80\/4f2ac5c80dce659ae9254a8f0487af0d.svg\" width=\"365\" height=\"48\"\/><\/p>\n<p> \u0421\u043e\u0431\u044b\u0442\u0438\u0435 <strong>B<\/strong>: \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0430\u0440\u044b (k2,n2)<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 AB \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e C: <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"P(AB|C)\" alt=\"P(AB|C)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b54\/fea\/25f\/b54fea25f65b75eb430bae85b4572f8f.svg\" width=\"79\" height=\"22\"\/>. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u043e\u0439 \u0411\u0430\u0439\u0435\u0441\u0430 \u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u0439 A \u0438 B.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"P(AB|C) = \\frac{P(C|AB)P(AB)}{P(C)} = \\frac{P(AB)}{P(C)} = \\frac{P(A)P(B)}{P(C)}\" alt=\"P(AB|C) = \\frac{P(C|AB)P(AB)}{P(C)} = \\frac{P(AB)}{P(C)} = \\frac{P(A)P(B)}{P(C)}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c7\/094\/44e\/8c709444e196ccc6f8bd7577ee05c88a.svg\" width=\"460\" height=\"50\"\/><\/p>\n<p>\u0422\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0447\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"P(C|AB)=1\" alt=\"P(C|AB)=1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/198\/77b\/9e8\/19877b9e8cbbe1cad9ad618904b73581.svg\" width=\"114\" height=\"22\"\/> \u0442.\u043a. AB \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 C. \u0414\u0430\u043b\u0435\u0435 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"formula\" source=\"P(AB|C) = \\frac{ C_{n_1}^{k_1}p^{k_1}(1-p)^{\\nu_1}                    C_{n_2}^{k_2}p^{k_2}(1-p)^{\\nu_2} }                  {C_{n_1+n_2}^{k_1+k_2}p^{k_1+k_2}(1-p)^{\\nu_1+\\nu_2}} =                   \\frac{ C_{n_1}^{k_1}                    C_{n_2}^{k_2} }                  {C_{n_1+n_2}^{k_1+k_2}}$$  \u042d\u0442\u043e \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435 \u043a\u0430\u043a \u0433\u0438\u043f\u0435\u0440\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 $$ HG(k_1;n_1+n_2,k_1+k_2,n_1) =                                                                             \\frac{ C_{k_1+k_2}^{k_1} C_{n_1+n_2-k_1-k_2}^{n_1-k_1} }                                                                            { \u0421_{n_1+n_2}^{n_1} } \" alt=\"P(AB|C) = \\frac{ C_{n_1}^{k_1}p^{k_1}(1-p)^{\\nu_1}                    C_{n_2}^{k_2}p^{k_2}(1-p)^{\\nu_2} }                  {C_{n_1+n_2}^{k_1+k_2}p^{k_1+k_2}(1-p)^{\\nu_1+\\nu_2}} =                   \\frac{ C_{n_1}^{k_1}                    C_{n_2}^{k_2} }                  {C_{n_1+n_2}^{k_1+k_2}}$$  \u042d\u0442\u043e \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435 \u043a\u0430\u043a \u0433\u0438\u043f\u0435\u0440\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 $$ HG(k_1;n_1+n_2,k_1+k_2,n_1) =                                                                             \\frac{ C_{k_1+k_2}^{k_1} C_{n_1+n_2-k_1-k_2}^{n_1-k_1} }                                                                            { \u0421_{n_1+n_2}^{n_1} } \" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/870\/5a0\/b22\/8705a0b22a12858707dc41fd6be1f6d2.svg\" width=\"460\" height=\"60\"\/><\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>\u041c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k_1\" alt=\"k_1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c36\/40b\/295\/c3640b29590c3a40bfb1d579ac8b9d5b.svg\" width=\"19\" height=\"19\"\/> \u043d\u0430 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k_1'\" alt=\"k_1'\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/444\/936\/0a1\/4449360a102ebd69c05b36f9589618d1.svg\" width=\"19\" height=\"22\"\/> \u0442.\u0435. \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 34 \u043f\u0440\u043e\u0434\u0430\u0436\u0438, \u0430 35 \u0438\u043b\u0438 36 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u0433\u0434\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k_1 + k_2 = k_1' + k_2'\" alt=\"k_1 + k_2 = k_1' + k_2'\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3f0\/87b\/147\/3f087b147ff87447b50dc7e6020bee21.svg\" width=\"148\" height=\"22\"\/>. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0431\u044b\u043b\u043e 35 \u043f\u0440\u043e\u0434\u0430\u0436, \u0442\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 &#8212; 27 \u0432\u043c\u0435\u0441\u0442\u043e 28.<\/p>\n<p><strong> \u0412\u0442\u043e\u0440\u043e\u0439 \u0448\u0430\u0433 <\/strong><\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438 (!) \u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b (\u0442.\u0435. \u0447\u0442\u043e <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"p\" alt=\"p\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fb1\/834\/d19\/fb1834d190410722ebf9852d116bcdd3.svg\" width=\"10\" height=\"15\"\/> \u0432 \u043e\u0431\u043e\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432), \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u0443\u043c\u043c\u044b \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u0442.\u0435. \u0441\u0443\u043c\u043c\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b).<\/p>\n<pre><code>#\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0438\u043f\u0435\u0440\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0435 print( math.comb(n1,k1)*math.comb(n2,k2)\/math.comb(n1+n2,k1+k2) ) #>>0.06830756250854167  print( ss.hypergeom(n1+n2,k1+k2,n1).pmf(k1) ) #>>0.06830756250854171 #\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0441 \u043e\u0442 \u0442\u043e\u0433\u043e, #\u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a k1 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c comb \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 k2 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c. <\/code><\/pre>\n<p>\u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438:<\/p>\n<pre><code>p_all = ss.hypergeom(n1+n2,k1+k2,n1).pmf(np.arange(0,63)) p_less = p_all[p_all &lt;= ss.hypergeom(n1+n2,k1+k2,n1).pmf(34)] print(f'''\u0414\u0432\u0443\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0442\u0435\u0441\u0442: {p_less.sum():.4f} ''') #>>\u0414\u0432\u0443\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0442\u0435\u0441\u0442: 0.3694   print(f'''\u0427\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e scipy: {ss.fisher_exact(np.array([[34,859],[28,895]])                               ,alternative='two-sided')[1]:.4f} ''') #>>\u0427\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e scipy: 0.3694   # \u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b k1, \u0433\u0434\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 np.array( [np.where(p_all==i)[0][0] for i in p_less] ) >>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,        17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 34, 35, 36, 37, 38, 39, 40,        41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,        58, 59, 60, 61, 62], dtype=int64)<\/code><\/pre>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e p-value \u043f\u043e\u0447\u0442\u0438 \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u0432\u0443\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u044b\u0448\u0435 (\u0445\u043e\u0442\u044f \u0432 \u0442\u044b\u0441\u044f\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0435\u0441\u0442\u044c). ANOVA c t-\u0442\u0435\u0441\u0442\u043e\u043c \u0438 \u0425\u04382 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043c\u0435\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0443\u0445\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 p-value (\u0442.\u043a. \u043e\u043d\u0438 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435\/\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0435).<\/p>\n<p>\u0422\u043e\u0447\u043d\u044b\u0439 \u0424\u0438\u0448\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043c\u0435\u0440\u044f\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430 0.035 \u0441\u043e\u0442\u044b\u0445, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435 \u043c\u0430\u043b\u043e.<\/p>\n<p>\u041f\u0440\u0438 &#171;\u0442\u043e\u0447\u043d\u043e\u043c \u0424\u0438\u0448\u0435\u0440\u0435&#187; \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u043e\u0431\u043e \u0437\u0430\u0431\u043e\u0438\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u0445, \u0433\u0430\u0443\u0441\u0441\u043e\u0432\u043e\u0441\u0442\u0438 \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0438\u0445. \u0412 \u043e\u0431\u0449\u0435\u043c \u0442\u0430\u043c \u0433\u0434\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043b\u0435\u0433\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<h3>Bootstrap \u0434\u043b\u044f \u043d\u0430\u0440\u043e\u0434\u0430 <\/h3>\n<p>\u041d\u0443 \u0438 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a, \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c. \u0412\u043e\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0432\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c. \u0422.\u0435. \u0414\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u043a\u0430\u043a 2 \u043c\u0435\u0448\u043a\u0430 \u0441 \u0447\u0435\u0440\u043d\u044b\u043c\u0438 \u0438 \u0431\u0435\u043b\u044b\u043c\u0438 \u0448\u0430\u0440\u0430\u043c\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0432\u044b\u043d\u0438\u043c\u0430\u0435\u043c \u0448\u0430\u0440\u044b \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043d\u0443\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0448\u0430\u0440\u043e\u0432. \u042d\u0442\u043e \u043d\u0430\u0448\u0430 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0418\u0437 \u043d\u0435\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434, \u043f\u0440\u0438 \u0432\u0441\u0435\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0435\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u0434\u0435 \u0443\u0433\u043e\u0434\u043d\u043e. \u0418 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0430\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0447\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0433\u0430\u0443\u0441\u0441\u043e\u0432\u043e\u0441\u0442\u044c \u0438 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e.<\/p>\n<pre><code>import plotly.express as px from scipy.stats import bootstrap<\/code><\/pre>\n<p>\u041c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u0438\u043c\u0435\u044e\u0442 \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442 0 \u0434\u043e k1-1. \u0418 \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0443\u0430\u0439\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e n1-1. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u043b\u0435 &lt; k1 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 (\u043f\u0440\u043e\u0434\u0430\u0436) \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439.<\/p>\n<p>\u041c\u044b \u0434\u0435\u043b\u0430\u0435\u043c M \u0442\u0430\u043a\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u0432 \u0433\u0440\u0443\u043f\u043f\u0430\u0445, \u0442.\u0435. <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"k_1^m\/n_1 - k_2^m\/n_2\" alt=\"k_1^m\/n_1 - k_2^m\/n_2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bd4\/026\/67d\/bd402667d2a5ebfc74d51d598e90e4c9.svg\" width=\"131\" height=\"23\"\/>, \u0433\u0434\u0435 <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"m=0...M-1\" alt=\"m=0...M-1\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f38\/edb\/9a5\/f38edb9a59bf7dc8f89289711e976938.svg\" width=\"122\" height=\"18\"\/>. \u042d\u0442\u043e \u0442\u0430\u043a\u0430\u044f &#171;\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044f&#187; \u0431\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/p>\n<pre><code>#\u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 rng = np.random.default_rng() M = 9999 dlt = np.zeros(M) m = k1\/n1 - k2\/n2 for i in range(M):         smpl1 = rng.integers(n1,size=n1)     k11 = (smpl1&lt;k1).sum()     smpl2 = rng.integers(n2,size=n2)     k12 = (smpl2&lt;k2).sum()     dlt[i] = k11\/n1 - k12\/n2 print('p-value: ', (  (dlt - m >= m) | (dlt - m &lt;= -m) ).sum()\/M ) #>>p-value:  0.36503650365036505<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0430\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0438\u0437 \u0431\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/p>\n<pre><code>sales1 = rng.binomial(n1,k1\/n1,M) sales2 = rng.binomial(n2,k2\/n2,M) dlt2 = sales1\/n1 - sales2\/n2 print('p-value: ', (  (dlt2 - m >= m) | (dlt2 - m &lt;= -m) ).sum()\/M ) #>>p-value:  0.35733573357335735<\/code><\/pre>\n<p><strong> <\/strong>\u0418\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 scipy <\/p>\n<pre><code>def difmean(s1,s2):     return s1.sum()\/s1.shape[0] - s2.sum()\/s2.shape[0] res = bootstrap((s1,s2), difmean, confidence_level=0.95, n_resamples=M, ) dlt3 = res.bootstrap_distribution print('p-value: ', (  (dlt3 - m >= m) | (dlt3 - m &lt;= -m) ).sum()\/M ) #>>p-value:  0.3611361136113611<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u0442\u043e\u043c\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u0441\u044b\u043b\u0430\u043b\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0414\u0430, p-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0442\u0430\u043a\u0438\u043c\u0438, \u043a\u0430\u043a\u0438\u043c\u0438 \u043c\u044b \u0438 \u043e\u0436\u0438\u0434\u0430\u043b\u0438. \u041d\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u044b \u0441\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 m. \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0438\u0437 <em>\u0434\u0432\u0443\u0445<\/em> \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0435\u0439. \u0418 \u044d\u0442\u043e, \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430, \u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0443 \u043d\u0430\u0441 \u043e\u0434\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0441 k1+k2 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u0430\u043c\u0438 \u043f\u0440\u0438 n1+n2 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f\u0445. \u0412\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432\u044b\u0448\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0442. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>#\u0422\u0443\u0442 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0438\u043a\u0443\u0434\u0430 \u0441\u043c\u0435\u0449\u0430\u0442\u044c. sales1 = rng.binomial(n1,(k1+k2)\/(n1+n2),M) sales2 = rng.binomial(n2,(k1+k2)\/(n1+n2),M) dlt4 = sales1\/n1 - sales2\/n2 print('p-value: ', ( (dlt4 >= m) | (dlt4 &lt;= - m) ).sum()\/M ) #>>p-value:  0.3625362536253625<\/code><\/pre>\n<pre><code>px.histogram({'bootstrap':res.bootstrap_distribution-m               ,'craftbootstrap':dlt4}              ,title='\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439'              ,histnorm='probability'              ,barmode=\"overlay\"              ,nbins=500)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e02\/c0f\/602\/e02c0f602f89425b0817aa15d282cf18.png\" width=\"1000\" height=\"481\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e02\/c0f\/602\/e02c0f602f89425b0817aa15d282cf18.png\"\/><\/figure>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0448\u0435 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u043e \u0438\u0437\u0440\u0435\u0437\u0430\u043d\u043d\u043e\u0435 &#8212; \u0442.\u043a. \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u0430 \u0438 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443.<\/p>\n<p>\u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439. \u041a\u0430\u043a\u0438\u043c \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b.<\/p>\n<pre><code>sales1 = rng.binomial(n1,k1\/n1,M) sales2 = rng.binomial(n2,k2\/n2,M) dlt5 = ( sales1\/n1 \/ ( sales2\/n2 ) ) px.histogram({'craftbootstrap':dlt5}              ,title='\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439'              ,histnorm='probability'              ,barmode=\"overlay\"              ,nbins=100)<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ff9\/fc1\/fc3\/ff9fc1fc335a996662be6f75453e7d18.png\" width=\"996\" height=\"487\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff9\/fc1\/fc3\/ff9fc1fc335a996662be6f75453e7d18.png\"\/><\/figure>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f<\/p>\n<p><strong> \u0418\u0442\u043e\u0433\u043e <\/strong><\/p>\n<p>\u0411\u044b\u0432\u0430\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0438\u0448\u044c \u043d\u0430 \u0437\u0430\u0431\u043e\u0440. \u0412 \u043d\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0449\u0435\u043b\u043e\u0447\u043a\u0438, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0438\u0434\u043d\u043e. \u0421\u0442\u043e\u0438\u0442 \u043f\u043e\u0435\u0445\u0430\u0442\u044c \u0432\u0434\u043e\u043b\u044c \u0437\u0430\u0431\u043e\u0440\u0430, \u043a\u0430\u043a \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0442\u0435\u0437 \u0430\u043f\u0435\u0440\u0442\u0443\u0440\u044b. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0443\u0433\u043b\u0430\u043c\u0438. \u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u043a \u0440\u0430\u0437 \u0432 \u044d\u0442\u043e\u043c \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f &#8212; \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/815291\/\"> https:\/\/habr.com\/ru\/articles\/815291\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/192000\/\" rel=\"noopener noreferrer nofollow\">\u0412\u043e\u0442 \u0442\u0443\u0442<\/a> \u0443\u0432. <a class=\"mention\" href=\"\/users\/dimview\">@dimview<\/a> \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445 \u0438 \u0421\u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0437\u0430 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f \u0440\u0435\u0448\u0430\u044f \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0418 \u0432 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 100500 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f (\u043d\u0435)\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u044b. <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u044f\u0434 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u044b\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f\u043e\u043c. \u0418\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0438\u0445 &#171;\u0440\u0443\u0447\u043d\u043e\u0439&#187; \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy.stats. \u0412 \u044d\u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435, \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u043d\u0438\u043c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0442.\u043a. \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0438 \u0443\u044f\u0441\u043d\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<p>\u0421\u0430\u043c\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a: <em>&#171;\u0418 \u0432\u043e\u0442 \u0441\u0432\u0435\u0436\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u2014 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 893 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0443 \u043d\u0430\u0441 \u0447\u0442\u043e-\u0442\u043e \u043a\u0443\u043f\u0438\u043b\u0438 34, \u0430 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u0437 923 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0447\u0442\u043e-\u0442\u043e \u043a\u0443\u043f\u0438\u043b\u0438 28. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0438\u0434\u0442\u0438 \u043a \u043d\u0430\u0447\u0430\u043b\u044c\u0441\u0442\u0432\u0443 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u00ab\u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f 3.81%, \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 3.03%, \u043d\u0430\u043b\u0438\u0446\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 26%, \u0433\u0434\u0435 \u043c\u043e\u044f \u043f\u0440\u0435\u043c\u0438\u044f?\u00bb \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 6 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 \u0435\u0449\u0451 \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430?&#187;<\/em><\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0440\u0435\u043c\u0430\u0440\u043a\u0430 \u043e  p-value \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430\u0445 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c. <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041c\u044b \u0438\u0441\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u043c\u0438 p-value (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/P-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u043a\u0438<\/a>) \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430. \u041d\u043e \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435. <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0442\u0435\u0441\u0442 \u0441 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u044a\u0435\u043c\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u043a. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437 893\u0445 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 34 \u043f\u0440\u043e\u0434\u0430\u0436\u0438, \u0432 &#171;\u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0439&#187; &#8212; 37, \u0435\u0449\u0435 \u0432 \u043e\u0434\u043d\u043e\u0439 &#8212; 28 \u0438 \u0442.\u0434.. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 923 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439 (\u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0434\u0430\u0436\/\u043e\u0431\u044a\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0438). \u0418 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0440\u0430\u0437\u043d\u0438\u0446. <\/p>\n<p>p-value = 0.05 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 5% \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0440\u0430\u0437\u043d\u0438\u0446. \u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e <em>\u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e<\/em> \u0440\u0430\u0437\u043d\u0438\u0446\u0443 <em>\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e <\/em>\u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 0.05. \u0418 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0448\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0447\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439. \u0415\u0441\u043b\u0438 \u0436\u0435 p-value = 0.35, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e &#8212; \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e. \u0418 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043b\u0443\u0447\u0448\u0435. \u0412 \u0446\u0435\u043b\u043e\u043c \u0436\u0435 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0432\u0435\u0440\u0438\u044f \u043c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0438.<\/p>\n<p>\u041a\u0430\u0441\u0430\u0435\u043c\u043e \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c 95% \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b &#8212; \u0437\u043d\u0430\u0447\u0438\u0442 95% \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 \u043d\u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0439, \u0442\u043e \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b 0 (\u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c). \u0418\u043d\u0430\u0447\u0435 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 &#8212; \u0432\u044b\u0441\u043e\u043a\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0447\u0442\u043e \u043d\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430 \u043e\u0434\u043d\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435. \u0418 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. <\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 <\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 &#8212; \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u0436\u0438 \u043a\u0430\u043a 1, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u043a 0. \u0418 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 (\u0442.\u0435. \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439). \u0418 \u043f\u0435\u0440\u0432\u043e\u0435, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u043c &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0443\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0439 t-\u0442\u0435\u0441\u0442.<\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0434\u0430\u0436 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; k1 (=34), \u0430 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 n1 (=893). \u0418 k2, n2 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b. \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b k1\/n1 &#8212; k2\/n2 \u0435\u0441\u043b\u0438 \u0431\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0438\u0440\u0430\u0445. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f: n1 \u0438 n2 \u0431\u044b\u043b\u0438 \u0431\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0430 k1 + k2 = const. \u041a\u0430\u043a \u0440\u0430\u0437 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 t-test \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy.stats \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c p-value.<\/p>\n<pre><code>import scipy.stats as ss #\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0431\u044b\u0440\u043e\u043a\u0430 n1 = 893 k1 = 34 #\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 n2 = 923 k2 = 28  s1 = np.zeros(n1) s1[:k1] = 1 s2 = np.zeros(n2) s2[:k2] = 1 ss.ttest_ind(s1,s2) #>>TtestResult(statistic=0.9075373501154826, pvalue=0.36424324967099464, df=1814.0)  #s1 \u0438 s2 - \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 1 - \u043f\u0440\u043e\u0434\u0430\u0436 #\u0438 0 - \u0438\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f. \u042d\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u0438 \u043d\u0430 \u0431\u0443\u0442\u0441\u0442\u0440\u0430\u043f\u0435. print(s1[:70]) #>>[1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.  1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.  0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]<\/code><\/pre>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d t-test. \u041c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 (\u0434\u0432\u0443\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0439 t-\u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439).<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0438\u0445 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f (). \u041f\u043e\u0434\u0435\u043b\u0438\u0432 \u043d\u0430\u0448\u0443 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b df = n1+n2-2.<\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0430) \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043b\u0438 \u0441\u0445\u043e\u0436\u0443\u044e \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u0431) \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 <em>\u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/em> \u0431\u044b\u043b\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0433\u0430\u0443\u0441\u0441\u043e\u0432\u043e, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u044f\u0436\u0435\u043b\u044b\u0435 \u0445\u0432\u043e\u0441\u0442\u044b \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u0443\u044e \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u044e \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435. \u041f\u0440\u0438 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 (\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u0438\u0445 \u0443 \u043d\u0430\u0441 \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e).<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c t-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0430 \u0438\u0437-\u0437\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u0438, \u0430 \u043d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441 \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0432 \u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044f\u0445.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u043d\u0435\u0441\u043c\u0435\u0449\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438<\/p>\n<pre><code>d1 = k1\/(n1-1)*(1-k1\/n1) d2 = k2\/(n2-1)*(1-k2\/n2) D = d1+d2  m = k1\/n1 - k2\/n2 std = np.sqrt( d1\/n1 + d2\/n2 ) t = m\/std print('t-value: ',t) df = n1+n2-2 print('p-value: ',1 - ss.t.cdf(t, df) ) >>t-value:  0.905901136585428 >>p-value:  0.18255424508928209  # \u041d\u0430\u0448\u0435 p-value \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0447\u0442\u0438 \u0432 2 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0438\u0437 \u0442\u0435\u0441\u0442\u0430. # \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b\u0438 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.  # \u0414\u043b\u044f \u0434\u0432\u0443\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u0448\u0442\u0443\u043a\u0443: print('two-side p-value: ',ss.t.cdf(-t, df) + 1 - ss.t.cdf(t, df) ) >>two-side p-value:  0.36510849017856417  #\u0418\u043b\u0438 \u043d\u0435\u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u043e \u0434\u043e\u043c\u0436\u043d\u043e\u0436\u0438\u0442\u044c \u043d\u0430 2, \u0442.\u043a. \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435  print('two-side p-value: ', (1 - ss.t.cdf(t, df))*2 ) two-side p-value:  0.36510849017856417  #\u041d\u0443 \u0438 \u0440\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c print('two-side p-value: ', (1 - ss.norm.cdf(m, scale=std) )*2 ) >>two-side p-value:  0.3649881826944741<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f p-value \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 4\u043c \u0437\u043d\u0430\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0442.\u043a. \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b \u043e\u0447. \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u043f\u0430\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c. \u0415\u0449\u0435 \u0443 \u0442\u0435\u0441\u0442\u0430 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 scipy \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0435 t-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043e\u0447\u0435\u043c\u0443).<\/p>\n<pre><code># \u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b 95% \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 print(f'{ss.t.ppf(.025,df,loc=m,scale=std)*100:.3f}%; {ss.t.ppf(.975,df,loc=m,scale=std)*100:.3f}%') >>-0.901%; 2.449%  # \u0418 \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e print(f'{ss.norm.ppf(.025,loc=m,scale=std)*100:.3f}%; {ss.norm.ppf(.975,loc=m,scale=std)*100:.3f}%') >>-0.900%; 2.448%<\/code><\/pre>\n<h3>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439  <\/h3>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u043a\u0430\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0443\u044e \u043c\u043e\u043d\u0435\u0442\u043a\u0443. \u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u041f\u0438\u0440\u0441\u043e\u043d\u0430 , \u0433\u0434\u0435 O \u0438 E &#8212; observed and expected \u0447\u0430\u0441\u0442\u043e\u0442\u044b. \u0418 \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442  \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043c\u043e\u043d\u0435\u0442\u043a\u0443 60 \u0440\u0430\u0437. \u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c (expect), \u0447\u0442\u043e \u043e\u0440\u0435\u043b \u0432\u044b\u043f\u0430\u0434\u0435\u0442 30 \u0440\u0430\u0437, 60-30 &#8212; \u0432\u044b\u043f\u0430\u0434\u0435\u0442 \u0440\u0435\u0448\u043a\u0430.<\/p>\n<p>\u0410 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c (observe)  20 \u0440\u0435\u0448\u0435\u043a \u0438 40 \u043e\u0440\u043b\u043e\u0432. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c E(\u043e\u0440\u043b\u0430)=\u0415(\u0440\u0435\u0448\u043a\u0430)=30. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u041e(\u0440\u0435\u0448\u043a\u0430)=20, \u041e(\u043e\u0440\u043b\u0430)=40.<\/p>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u043c\u0438. \u041a\u0430\u043a\u043e\u0432\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b, \u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430 (\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c  &#8212; \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443)? \u041f\u043e\u0440\u0435\u0448\u0430\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>R\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0441\u0432\u043e\u0431\u043e\u0434\u044b: <br \/>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0432\u043d\u043e (2-1)(2-1) = 2<\/p>\n<pre><code># \u041d\u0430\u0439\u0434\u0435\u043c \u043e\u0431\u0449\u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435. # \u041c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 # \u0438\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u043e\u0439 # \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u0445 \u0447\u0430\u0442\u043e\u0442\u0430 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430. total_mean = (k1+k2)\/(n1+n2)  #\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u044b, \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u044b \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 #\u0431\u044b\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0434\u0438\u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 k1_e = n1*total_mean k2_e = n2*total_mean print(f'k1 expected = {k1_e:.1f}; k2 expected = {k2_e:.1f}') #>>k1 expected = 30.5; k2 expected = 31.5  #\u042d\u0442\u043e \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442 \"\u043f\u0440\u043e\u043c\u0430\u0445\u043e\u0432\" t1 = n1 - k1 t2 = n2 - k2  t1_e = n1*(t1+t2)\/(n1+n2) t2_e = n2*(t1+t2)\/(n1+n2)  #\u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 1 - total_mean #\u0432\u043c\u0435\u0441\u0442\u043e (t1+t2)\/(n1+n2)  print(f't1 expected = {t1_e:.1f}; t2 expected = {t2_e:.1f}') #>>t1 expected = 862.5; t2 expected = 891.5  O = np.array([k1,k2,t1,t2]) E = np.array([k1_e,k2_e,t1_e,t2_e])  chi2 = sum( (O-E)**2\/E ) print('\u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 chi2: ',chi2) #>>\u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 chi2:  0.8241579182647449  print(f'p-value: {1 - ss.chi2(1).cdf(chi2):.3f}', ) #>>p-value: 0.364<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0443\u0442 \u043d\u0430 2 \u043d\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c, \u0442.\u043a. \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0438 \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0435. \u041d\u0443 \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u043c  \u0438\u0437 scipy<\/p>\n<pre><code>#\u0422\u0443\u0442 \u043c\u044b \u0443\u0431\u0440\u0430\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0443 \u0419\u0435\u0439\u0442\u0441\u0430 res = ss.chi2_contingency( [[k1,k2],[n1-k1,n2-k2]], correction=False) print(f'\u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u04382: {res.statistic:.3f}') #>>\u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u04382: 0.824  print(f'p-value: {res.pvalue:.3f}') #>>p-value: 0.364<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u044e\u0442 \u0441 \u0442\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0434\u043b\u044f t-\u0442\u0435\u0441\u0442\u0430. \u0427\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f\u00a0<a href=\"https:\/\/stats.stackexchange.com\/questions\/173415\/at-what-level-is-a-chi2-test-mathematically-identical-to-a-z-test-of-propo\" rel=\"noopener noreferrer nofollow\"><u>\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c<\/u><\/a>\u00a0\u044d\u0442\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 2\u04452. <\/p>\n<h3>ANOVA  <\/h3>\n<p><strong>\u041e\u0434\u043d\u043e\u0444\u0430\u043a\u0442\u043e\u0440\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437.<\/strong><\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438  \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 t-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c &#8212; \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0445\u04382 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 anova \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0439 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, F-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<p>Anova \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442. \u0415\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f \u0442\u0430\u043a \u0438 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 (\u0432\u043d\u0443\u0442\u0440\u0438\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0438 \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0434\u0438\u0441\u043f\u0435\u0440\u0441\u0438\u0438). \u041d\u0430 \u0446\u0438\u0444\u0440\u0430\u0445 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0435\u0441\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b , \u0433\u0434\u0435 j=1..M &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u043f\u043f (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 2), \u0430 i=1..N &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0433\u0440\u0443\u043f\u043f\u0435 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 893 \u0438 923).<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0431\u0449\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 <\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u043d\u0430\u0439\u0434\u0435\u043c \u043e\u0431\u0449\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432<\/p>\n<p>SST \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0435\u043c <strong> \u0432\u043d\u0443\u0442\u0440\u0435\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e <\/strong> \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 <\/p>\n<p>\u0422.\u0435. \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 .  . \u0422.\u0435. \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0438\u043d\u0443\u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u043f\u043f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c <strong> \u043c\u0435\u0436\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443 <\/strong> \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 <\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u0434\u043e\u043c\u043d\u043e\u0436\u0438\u043b\u0438 \u043d\u0430<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-376478","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=376478"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376478\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=376478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=376478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=376478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}