{"id":284456,"date":"2017-04-05T11:35:02","date_gmt":"2017-04-05T07:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284456"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284456","title":{"rendered":"\u041e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438: \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043a\u0443\u0440\u0441\u0443"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e10\/0e1\/5a9\/e100e15a9a3e42e4869217f10bc3132d.png\"\/><br \/>  \u041d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0444\u0442\u0438 (\u0438 \u043e\u0442 \u043a\u043e\u0435-\u0447\u0435\u0433\u043e \u0435\u0449\u0435). \u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habrahabr.ru\/post\/233059\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u044f \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u0442\u044c \u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f, \u043d\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438? \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0441\u0442 \u0438 \u043f\u043e\u043d\u044f\u0442\u0435\u043d, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b <del>(\u043d\u0435 \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435)<\/del>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"dannye-i-diagnostika-mnk\">\u0414\u0430\u043d\u043d\u044b\u0435 \u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u041c\u041d\u041a<\/h2>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u043e\u0431\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u0443\u0440\u0441\u0430 \u0440\u0443\u0431\u043b\u044f \u043e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0444\u0442\u0438. \u041f\u043e\u043c\u043d\u0438\u0442\u0435 <a href=\"https:\/\/habrahabr.ru\/post\/253285\/\">\u044d\u0442\u043e\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442<\/a>? \u0421\u043f\u0443\u0441\u0442\u044f \u0434\u0432\u0430 \u0433\u043e\u0434\u0430 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u0421\u0432\u0435\u0436\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0441 <a href=\"http:\/\/www.quandl.com\">Quandl<\/a>: \u0437\u0430 \u043a\u043e\u0434\u043e\u043c &quot;EIA\/PET_RBRTE_D&quot; \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Spot_contract\">\u0441\u043f\u043e\u0442\u043e\u0432\u0430\u044f \u0446\u0435\u043d\u0430<\/a> \u043d\u0430 \u043d\u0435\u0444\u0442\u044c \u043c\u0430\u0440\u043a\u0438 Brent \u0432 $, \u0430 \u0437\u0430 &quot;BOE\/XUDLBK69&quot; \u2014 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c 1 \u0434\u043e\u043b\u043b\u0430\u0440\u0430 \u0432 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0440\u0443\u0431\u043b\u044f\u0445. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0430\u043d\u043d\u044b\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>library(Quandl) library(zoo) library(dplyr) oil.ts &lt;-Quandl(&quot;EIA\/PET_RBRTE_D&quot;, trim_start=&quot;2005-04-03&quot;, trim_end=&quot;2017-03-10&quot;, type=&quot;zoo&quot;, collapse=&quot;weekly&quot;) usd.ts &lt;-Quandl(&quot;BOE\/XUDLBK69&quot;, trim_start=&quot;2005-04-03&quot;, trim_end=&quot;2017-03-10&quot;, type=&quot;zoo&quot;, collapse=&quot;weekly&quot;)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u2014 \u0441 \u0430\u043f\u0440\u0435\u043b\u044f 2005 \u043f\u043e \u043c\u0430\u0440\u0442 2017 \u0433\u043e\u0434\u0430. \u0418 \u0432\u043e\u0442 \u043a\u0430\u043a\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u044d\u0442\u043e\u0442 \u043f\u0435\u0440\u0438\u043e\u0434, \u0435\u0441\u043b\u0438 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0443\u0431\u043b\u044f \u0432 \u0434\u043e\u043b\u043b\u0430\u0440\u0430\u0445:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d25\/881\/dc1\/d25881dc18c942aab9d172df02c62bfe.png\" alt=\"image\"\/><br \/>  \u0415\u0441\u043b\u0438 \u0441\u0443\u0434\u0438\u0442\u044c \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443, \u0442\u043e \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043a\u0440\u0438\u0432\u044b\u043c\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0443\u0431\u043b\u044f \u0438 \u043d\u0435\u0444\u0442\u0438 \u043f\u0440\u043e\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 2012 \u0433. \u043e\u043d\u0430 \u0441\u0442\u0430\u043b\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0442\u0435\u0441\u043d\u043e\u0439. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044e \u041c\u041d\u041a \u0437\u0430 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0433\u043e\u0434\u0430, \u0442.\u043a. \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0440\u0435\u0437\u043a\u0438\u043c\u0438 \u043a\u043e\u043b\u0435\u0431\u0430\u043d\u0438\u044f\u043c\u0438 \u0446\u0435\u043d \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0441\u0435 \u043f\u043b\u043e\u0445\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 \u043c\u0430\u0440\u0442\u0430 2015 \u0433. \u043f\u043e \u0434\u0435\u043a\u0430\u0431\u0440\u044c 2016 \u0433. \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430; \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 2017 \u0433. \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<br \/>  \u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440 \u0441\u0432\u044f\u0437\u0438 \u0441 2015 \u0433. \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f, \u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f rub<sub>i<\/sub>=a+b\u00b7oil<sub>i<\/sub>, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ordinary_least_squares\">\u041c\u041d\u041a<\/a> \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u043c\u0430:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u041d\u041a<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>tr.s &lt;- &quot;2015-03-01&quot;; tr.e &lt;- &quot;2016-12-31&quot; train &lt;- data.frame(oil=as.vector(window(oil.ts, start=tr.s, end=tr.e)),                     rub=as.vector(window(rub.ts, start=tr.s, end=tr.e)),                     date=index(window(oil.ts, start=tr.s, end=tr.e))) %&gt;%    mutate(month=factor(format(date, &quot;%m&quot;)),           date=NULL) te.s &lt;- &quot;2017-01-01&quot;; te.e &lt;- &quot;2017-03-15&quot; test &lt;- data.frame(oil=as.vector(window(oil.ts, start=te.s, end=te.e)),                    rub=as.vector(window(rub.ts, start=te.s, end=te.e)),                    date=index(window(oil.ts, start=te.s, end=te.e))) %&gt;%    mutate(month=factor(format(date, &quot;%m&quot;)),           date=NULL) fit1 &lt;- lm(rub ~ oil, data=train) summary(fit1) ##  ## Call: ## lm(formula = rub ~ oil, data = train) ##  ## Residuals: ##        Min         1Q     Median         3Q        Max  ## -2.096e-03 -3.265e-04  4.510e-06  3.491e-04  1.871e-03  ##  ## Coefficients: ##              Estimate Std. Error t value Pr(&gt;|t|)     ## (Intercept) 7.284e-03  3.396e-04   21.45   &lt;2e-16 *** ## oil         1.777e-04  7.009e-06   25.35   &lt;2e-16 *** ## --- ## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ##  ## Residual standard error: 0.0005883 on 94 degrees of freedom ## Multiple R-squared:  0.8724, Adjusted R-squared:  0.871  ## F-statistic: 642.7 on 1 and 94 DF,  p-value: &lt; 2.2e-16<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d5d\/9c9\/4c6\/d5d9c94c6dafcbfac2f9b127e705609b.svg\" alt=\"$rub_i=0.0073+0.000178\\cdot oil_i$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0447\u043b\u0435\u043d, \u0442\u043e R<sup>2<\/sup> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0440\u0430\u0432\u0435\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0435. \u042d\u0442\u043e\u043c\u0443 \u0435\u0441\u0442\u044c <a href=\"http:\/\/stats.stackexchange.com\/questions\/26176\/removal-of-statistically-significant-intercept-term-increases-r2-in-linear-mo\/26205#26205\">\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/a>. \u041a\u0430\u043a \u0431\u044b \u044d\u0442\u043e \u043d\u0438 \u0431\u044b\u043b\u043e \u0437\u0430\u043c\u0430\u043d\u0447\u0438\u0432\u043e, \u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0439 \u0447\u043b\u0435\u043d \u043d\u0435\u043b\u044c\u0437\u044f (\u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043b\u0438\u043d\u0438\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0447\u0430\u043b\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442): \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/stats.stackexchange.com\/questions\/7948\/when-is-it-ok-to-remove-the-intercept-in-a-linear-regression-model\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 R<sup>2<\/sup> \u2014 \u044d\u0442\u043e\u0442 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 <a href=\"http:\/\/data.library.virginia.edu\/is-r-squared-useless\/\">\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u043b\u0435\u043d<\/a>. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u043e \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e, \u043f\u043e\u0445\u043e\u0436\u0435, \u0431\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/333\/1d0\/e94\/3331d0e943104b5faf7b7556d894b88f.png\" alt=\"\u043e\u0441\u0442\u0430\u0442\u043a\u0438\"\/><\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>library(lmtest) dwtest(fit1) ##  ##  Durbin-Watson test ##  ## data:  fit1 ## DW = 0.49421, p-value &lt; 2.2e-16 ## alternative hypothesis: true autocorrelation is greater than 0 resettest(fit1) ##  ##  RESET test ##  ## data:  fit1 ## RESET = 13.999, df1 = 2, df2 = 92, p-value = 4.924e-06<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/187\/ba5\/ee6\/187ba5ee6d4e402693ed6ae128a1c38f.png\" alt=\"image\"\/><br \/>  \u0422\u0435\u0441\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Durbin\u2013Watson_statistic\">\u0414\u0430\u0440\u0431\u0438\u043d\u0430-\u0423\u043e\u0442\u0441\u043e\u043d\u0430<\/a> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 (\u043a\u0442\u043e \u0431\u044b \u043c\u043e\u0433 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c) <a href=\"https:\/\/en.wikipedia.org\/wiki\/Autocorrelation\">\u0430\u0432\u0442\u043e\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438<\/a>; \u043a\u043e\u0440\u0440\u0435\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0438\u043f\u0430 AR(1) (\u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0438\u0436\u0435). <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ramsey_RESET_test\">RESET-\u0442\u0435\u0441\u0442<\/a> \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043e \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442.\u043a. \u043d\u0430 \u043a\u0443\u0440\u0441 \u0432\u043b\u0438\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432 (\u043b\u0438\u0431\u043e \u041c\u041d\u041a \u2014 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c). \u0412\u0441\u0435 \u044d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ordinary_least_squares\">\u041c\u041d\u041a<\/a>. \u0422\u043e\u0442, \u043a\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439, \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0435\u0439 \u043d\u0430\u0434\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0442.\u043a. \u0432\u0441\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435 \u0438 \u043d\u0435\u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0435, \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b. \u0418\u0437 \u0432\u0441\u0435\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0449\u0435 \u0442\u0430\u043a\u043e\u0439 \u0442\u0440\u044e\u043a: \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f, \u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b. \u041a\u0430\u043a \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c? \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439, \u043b\u0438\u0431\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0435\u043c \u0442\u0438\u043f\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Akaike_information_criterion\">AIC<\/a>. \u0414\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0432 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u043a\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b AIC \u0438 CV \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f. \u041a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435, \u043a\u0430\u043a \u0440\u0430\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e: \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0441\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u043e\u0442 1 \u0434\u043e 5, \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f AIC \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"http:\/\/stackoverflow.com\/questions\/19484053\/what-does-the-r-function-poly-really-do\">poly()<\/a> \u0441\u0442\u0440\u043e\u0438\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Orthogonal_polynomials\">\u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u044b<\/a>, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0445 \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code>which.min(sapply(1:5, function(i) AIC(lm(rub ~ poly(oil, i), data=train)))) ## [1] 3<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438 \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c6b\/555\/8e1\/c6b5558e13733057bb2e2fced872ca64.svg\" alt=\"$rub_i=a+b\\cdot oil_i + b_2\\cdot oil_i^2 + b_3\\cdot oil_i^3$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<h2 id=\"vremennye-ryady-i-oshibki\">\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0440\u044f\u0434\u044b \u0438 \u043e\u0448\u0438\u0431\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u041e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Time_series\">\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u0430\u0445<\/a> \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0438 \u0441 <a href=\"https:\/\/habrahabr.ru\/post\/243211\/\">\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c<\/a> <a href=\"https:\/\/habrahabr.ru\/company\/ods\/blog\/323730\/\"> \u0443\u0441\u043f\u0435\u0445\u043e\u043c<\/a>. \u041d\u0430\u043c \u0436\u0435 \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u0432\u043e\u0442 \u0447\u0442\u043e. \u0418 \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f, \u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0435\u0444\u0442\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u044f\u0434\u0430\u043c\u0438, \u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f (\u043e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0432 \u041c\u041d\u041a). \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Autoregressive_model\">\u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430<\/a>. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0440\u044f\u0434\u0443 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u043b\u044e\u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e6e\/6ac\/0cd\/e6e6ac0cd76120f5b4e5b76ccb794b37.svg\" alt=\"$u_{t}=c+\\phi u_{t-1}+\\epsilon_t,$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0433\u0434\u0435 \u03b5<sub>t<\/sub> &#8212;<a href=\"https:\/\/en.wikipedia.org\/wiki\/White_noise\"> \u0431\u0435\u043b\u044b\u0439 \u0448\u0443\u043c<\/a>.<br \/>  \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Autoregressive_integrated_moving_average\">ARIMA<\/a> \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u043e\u043c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ARIMA<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>library(forecast) fit2 &lt;- auto.arima(train$rub, xreg=train$oil) summary(fit2) ## Series: train$rub  ## Regression with ARIMA(1,0,0) errors  ##  ## Coefficients: ##          ar1  intercept  train$oil ##       0.9123     0.0108      1e-04 ## s.e.  0.0417     0.0004      0e+00 ##  ## sigma^2 estimated as 1.274e-07:  log likelihood=626.46 ## AIC=-1244.91   AICc=-1244.47   BIC=-1234.65 ##  ## Training set error measures: ##                        ME        RMSE          MAE        MPE     MAPE ## Training set 1.424521e-05 0.000351317 0.0002580076 0.02303551 1.610766 ##                   MASE       ACF1 ## Training set 0.7766594 0.02983604<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0418\u0437 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 rub<sub>i<\/sub>=a+b\u00b7oil<sub>i<\/sub> + u<sub>i<\/sub> \u043e\u0448\u0438\u0431\u043a\u0438 u<sub>i<\/sub> \u0438\u043c\u0435\u044e\u0442 \u0430\u0432\u0442\u043e\u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 ARIMA(1, 0, 0), \u0442.\u0435. \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 AR(1). <\/p>\n<p>  <\/p>\n<p>\u0422.\u043a. \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Generalized_least_squares\">\u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 (GLS)<\/a>. \u0412 GLS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u0434\u0435\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b y=Xb+\u03b5 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0430\u0445 \u0438 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/340\/cb6\/14d\/340cb614dea54fe44f68d3b2ea37b683.svg\" alt=\"$ b_{OLS}=(X^TX)^{-1}X^Ty \\\\ Var(b_{OLS})=\\sigma^2(X^TX)^{-1}, $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 GLS \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ca7\/905\/fdb\/ca7905fdbb8abb9dc2dfc950eb503d7d.svg\" alt=\"$ b_{GLS}=(X^T\\Sigma^{-1}X)^{-1}X^T\\Sigma^{-1}y \\\\ Var(b_{GLS})=(X^T\\Sigma^{-1}X)^{-1} $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u03a3 \u2014 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u0437\u043d\u0430\u044f \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u0442\u0430\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bias_of_an_estimator\">\u043d\u0435\u0441\u043c\u0435\u0449\u0435\u043d\u043d\u044b\u0435<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Efficiency_%28statistics%29\">\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Consistent_estimator\">\u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0435<\/a> \u0438 \u0430\u0441\u0438\u043c\u043f\u0442\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438 ( <a href=\"http:\/\/www.sfu.ca\/~swoodcoc\/teaching\/sp2014\/econ837\/14.gls1.pdf\">\u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0410\u0439\u0442\u043a\u0435\u043d\u0430<\/a>).<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">GLS<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>library(nlme) fit3 &lt;- gls(rub ~ oil, data=train, correlation=corAR1(value=0.7, form=~1|month)) summary(fit3) ## Generalized least squares fit by REML ##   Model: rub ~ oil  ##   Data: train  ##         AIC       BIC   logLik ##   -1173.847 -1163.674 590.9237 ##  ## Correlation Structure: AR(1) ##  Formula: ~1 | month  ##  Parameter estimate(s): ##       Phi  ## 0.7478772  ##  ## Coefficients: ##                   Value    Std.Error  t-value p-value ## (Intercept) 0.007860934 0.0004055443 19.38366       0 ## oil         0.000163683 0.0000081087 20.18601       0 ##  ##  Correlation:  ##     (Intr) ## oil -0.952 ##  ## Standardized residuals: ##         Min          Q1         Med          Q3         Max  ## -2.96100735 -0.41075284  0.07903953  0.62870157  3.42607023  ##  ## Residual standard error: 0.0006099571  ## Degrees of freedom: 96 total; 94 residual<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/559\/715\/b15\/559715b15d7c93e9d64934eff33784a9.svg\" alt=\"$rub_i=0.00786+0.000164\\cdot oil_i$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043b\u0438 \u043c\u044b \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0432\u044b\u0433\u043e\u0434\u0443 \u043e\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u0432 GLS \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044e AIC:<\/p>\n<p>  <\/p>\n<pre><code>which.min(sapply(1:5, function(i) {   d &lt;- data.frame(poly(train$oil, i), month=train$month, rub=train$rub)   AIC(gls(rub ~ . - month, data=d, correlation=corAR1(value=0.7, form=~1|month))) })) ## [1] 1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0430 \u0432 1 \u0441\u0442\u0435\u043f\u0435\u043d\u0438. \u0418, \u043a\u0441\u0442\u0430\u0442\u0438, \u0441\u0430\u043c\u0438 \u0441\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 (\u0445\u043e\u0442\u044f \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432):<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3b5\/f75\/dec\/3b5f75dece534ea7844fd45fe72dd95a.png\" alt=\"im\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"regressiya-bayesa-i-veroyatnostnyy-vybor-peremennyh\">\u0420\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0411\u0430\u0439\u0435\u0441\u0430 \u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/h2>\n<p>  <\/p>\n<p>\u041a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u043c\u043e\u0434\u0435\u043b\u0438: OLS, ARIMA(1, 0, 0), GLS \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 AR(1). \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0438 \u0432 \u0438\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435, \u0437\u0430\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043d\u0443\u0436\u043d\u044b \u043b\u0438 \u043d\u0430\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/22f\/667\/aae\/22f667aae5467654fa496fba328ea0eb.svg\" alt=\"$ y_i \\sim N(a + X_i^T \\cdot b, \\tau) \\\\ X_i = [x_i, x_i^2, x_i^3, x_i^4, x_i^5 ] \\\\ b = [b_1, b_2, b_3, b_4, b_5]\\\\ b_j = I_j \\cdot b_{{\\tau}_j},\\ j=1..5 \\\\ I_j \\sim Bernoulli(p) \\\\ b_{\\tau_j} \\sim N(0, \\tau_b) \\\\ a \\sim N(0, 10^{-4}) \\\\ \\tau \\sim Gamma(1, 10^{-3}) \\\\ \\tau_b \\sim Gamma(1, 10^{-3}) \\\\ p \\sim Beta(2, 9) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f y<sub>i<\/sub> \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 x<sub>i<\/sub>. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0438 \u0435\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 &quot;\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c&quot; \u0432 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 I<sub>j<\/sub>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bernoulli_distribution\">\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0411\u0435\u0440\u043d\u0443\u043b\u043b\u0438<\/a> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c p, \u0442.\u0435. \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0 \u0438\u043b\u0438 1. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 p \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Beta_distribution\">\u0431\u0435\u0442\u0430-\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/a>, \u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u03c4 \u0438 \u03c4<sub>b<\/sub> \u2014 \u0438\u0437 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Gamma_distribution\">\u0433\u0430\u043c\u043c\u0430<\/a>. \u0422\u0430\u043a \u043c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prior_probability\">\u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/a>. \u041e\u0442\u043a\u0443\u0434\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0438\u0445 \u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b? \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0442\u0435\u043e\u0440\u0438\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u043d\u044f\u0442\u043d\u0430\u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0431\u043e \u043d\u0430 \u043d\u0430\u0448\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043e \u043f\u0440\u0438\u0440\u043e\u0434\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438\u043b\u0438 \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e, \u043b\u0438\u0431\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prior_probability#Uninformative_priors\">\u043d\u0435\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/a>. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u044b\u0432\u043e\u0434 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439. \u0418 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bayes&#39;_rule\">\u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0411\u0430\u0439\u0435\u0441\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/803\/ba4\/b31\/803ba4b318fe2c97c1486aa197e31095.svg\" alt=\"$ p(\\theta| y) = \\frac{p(y|\\theta)}{p(y)}p(\\theta)\\propto p(y|\\theta)p(\\theta) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 p(\u03b8|y) \u2014 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Posterior_probability\">\u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/a>, p(y|\u03b8) \u2014 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Likelihood_function\">\u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u0438\u0435<\/a>, p(\u03b8) \u2014 \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0422\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/95f\/a4a\/65d\/95fa4a65d9a9e11134ca0544fd4092a5.svg\" alt=\"$p(\\theta|y_1) \\propto p(y_1|\\theta)p(\\theta)$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0418 \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u0438\u043d\u0435\u0440\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9a2\/54b\/16e\/9a254b16e5fa187045f06ead29d43c22.svg\" alt=\"$p(\\theta|y_1,\\ldots,y_i) \\propto p(y_i|\\theta)p(\\theta|y_1,\\ldots,y_{i-1})$\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 y<sub>i<\/sub> (\u0443 \u043d\u0430\u0441 \u044d\u0442\u043e \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f), \u0442\u043e \u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0440\u0438\u0432\u0443\u044e, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 (\u0438\u043b\u0438 \u043b\u043e\u0433\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435&#8230;). \u0410 \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u044b\u0431\u043e\u0440 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0413\u0430\u0443\u0441\u0441\u0430 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u043c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0430\u043f\u0440\u0438\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439. \u0412 R \u044d\u0442\u043e <a href=\"https:\/\/cran.r-project.org\/web\/packages\/rjags\/index.html\">rjags<\/a>, \u0438 \u0435\u0449\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u0438\u0437 <a href=\"https:\/\/cran.r-project.org\/web\/packages\/R2jags\/index.html\">R2jags<\/a>. \u0412\u0441\u0435 \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Bayesian Variable Selection<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>library(R2jags) model1 &lt;- &quot;model {   for (i in 1:n) {     y[i] ~ dnorm(a + inprod(X[i,], b[]), tau)   }   for (j in 1:p) {     ind[j] ~ dbern(pind)     bT[j] ~ dnorm(0, taub)     b[j] &lt;- ind[j] * bT[j]   }   a ~ dnorm(0, 1e-04)   tau ~ dgamma(1, 1e-03)   taub ~ dgamma(1, 1e-03)   pind ~ dbeta(2, 9) }&quot; p &lt;- 5 m.jags1 &lt;- jags(data=list(y=train$rub,                           X=poly(train$oil, p),                           n=nrow(train),                           p=p),                 parameters.to.save=c(&quot;a&quot;, &quot;b&quot;, &quot;ind&quot;),                 model.file=textConnection(model1),                 n.chains=1, n.iter=5000) m.jags1 ## Inference for Bugs model at &quot;5&quot;, fit using jags, ##  1 chains, each with 5000 iterations (first 2500 discarded), n.thin = 2 ##  n.sims = 1250 iterations saved ##           mu.vect sd.vect     2.5%      25%      50%      75%    97.5% ## a           0.016   0.000    0.015    0.015    0.016    0.016    0.017 ## b[1]        0.011   0.007    0.000    0.006    0.013    0.017    0.023 ## b[2]        0.000   0.001    0.000    0.000    0.000    0.000    0.003 ## b[3]        0.000   0.001    0.000    0.000    0.000    0.000    0.000 ## b[4]        0.000   0.001    0.000    0.000    0.000    0.000    0.000 ## b[5]        0.000   0.001    0.000    0.000    0.000    0.000    0.000 ## ind[1]      0.764   0.425    0.000    1.000    1.000    1.000    1.000 ## ind[2]      0.046   0.210    0.000    0.000    0.000    0.000    1.000 ## ind[3]      0.034   0.180    0.000    0.000    0.000    0.000    1.000 ## ind[4]      0.031   0.174    0.000    0.000    0.000    0.000    1.000 ## ind[5]      0.045   0.207    0.000    0.000    0.000    0.000    1.000 ## deviance -848.261  15.731 -876.531 -858.633 -848.740 -838.639 -815.570 ##  ## DIC info (using the rule, pD = var(deviance)\/2) ## pD = 123.7 and DIC = -724.5 ## DIC is an estimate of expected predictive error (lower deviance is better).<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0440\u0435\u0434\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 I<sub>j<\/sub> \u043f\u0440\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u0445 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 b<sub>2<\/sub>,&#8230;,b<sub>5<\/sub> \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0435 I<sub>1<\/sub>, \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u0430\u0432\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0444\u0442\u0438. \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432 \u043e\u0448\u0438\u0431\u043a\u0430\u0445:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Bayes AR1<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>model2 &lt;- &quot;model {   a ~ dt(0, 5, 1)   b ~ dt(0, 5, 1)   phi ~ dunif(-1, 0.999)   tau0 ~ dgamma(1, 1e-03)   tau[1] &lt;- tau0   y[1] ~ dnorm(a + b * x[1], tau[1])   for (i in 2:n){     tau[i] &lt;- tau0 + phi * tau[i-1]     y[i] ~ dnorm(a + b * x[i], tau[i])    } }&quot; set.seed(123) n &lt;- nrow(test) m.jags2 &lt;- jags(data=list(y=c(train$rub, rep(NA, n)),                           x=c(train$oil, test$oil),                           n=nrow(train)+n),                 parameters.to.save=c(&quot;a&quot;, &quot;b&quot;, &quot;phi&quot;, &quot;y&quot;),                 model.file=textConnection(model2),                 n.chains=1, n.iter=5000)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0430\u043f\u043e\u0441\u0442\u0435\u0440\u0438\u043e\u0440\u043d\u044b\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/915\/ebe\/364\/915ebe36460b4686b9241c4bb5e3ba59.png\" alt=\"image\"\/><br \/>  \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 GLS. \u0421\u0430\u043c\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u0434\u043b\u044f \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e6c\/fcf\/06d\/e6cfcf06dbb1fa79992e1d22ff8183e5.svg\" alt=\"$ rub_i \\sim N(0.0081+0.000157\\cdot oil_i, \\tau_i) $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 95% \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u0443\u0440\u0441\u0430 \u0434\u043e\u043b\u043b\u0430\u0440\u0430 \u0432 2017 \u0433. (\u043a\u0440\u0430\u0441\u043d\u044b\u043c\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f):<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cc6\/cfa\/ba1\/cc6cfaba1eec4f8391234d5e9d46f3ac.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0433\u0440\u0430\u0444\u0438\u043a \u0441 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u043d\u0438\u044f\u043c\u0438 \u043a\u0443\u0440\u0441\u0430 \u0434\u043e\u043b\u043b\u0430\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438 \u0438\u0445 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mean_absolute_error\">\u043e\u0448\u0438\u0431\u043a\u0438<\/a>. \u0422\u0430\u043a\u0438\u043c\u0438 \u0432\u043e\u0442 \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c\u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f\u043c\u0438 \u043c\u044b \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f MAE \u0441 3.1e-04 \u0443 OLS \u0434\u043e 2.7e-04 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0430\u0432\u0442\u043e\u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u0440\u0438\u0447\u0435\u043c GLS \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u0430\u043a \u0438 \u0431\u0430\u0439\u0435\u0441\u043e\u0432\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043d\u043e \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u043c\u043e\u0440\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4ed\/b53\/889\/4edb538899ac47f18b4a090e424e024c.png\" alt=\"image\"\/><br \/>  \u0417\u0430\u0447\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0443, \u0435\u0441\u043b\u0438 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u0436 \u0438 \u043f\u0440\u0435\u0432\u0437\u043e\u0448\u043b\u0430 OLS? \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0442\u0435\u043f\u0435\u0440\u044c \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u043a \u041c\u041d\u041a; \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0441\u0435 \u0436\u0435 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b; \u0432-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0439 (\u0430 \u043d\u0435 \u0434\u043e\u0432\u0435\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439!) \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0439 \u043d\u0430\u0441 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u0434\u043e\u043b\u043b\u0430\u0440 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445 \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0432 95% \u043f\u0440\u0438 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0444\u0442\u0438 50.63USD\/bbl., \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/05e\/b68\/a31\/05eb68a31c56466cbfc77a2d5dfc075f.png\" alt=\"image\"\/><br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0430\u043a\u0430\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0447\u0442\u043e-\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u043d\u0435\u043e\u0445\u043e\u0442\u0430 \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044f\u043c\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b, \u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0437\u0430\u0441\u043b\u0443\u0436\u0435\u043d\u043d\u043e \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Generalized_least_squares\">\u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 (GLS)<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 \u043e\u0446\u0435\u043d\u043a\u0438, \u0447\u0435\u043c \u043f\u0440\u0438 \u0441\u043b\u0435\u043f\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 OLS. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043e\u0431 auto.arima(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 \u043e\u0441\u0442\u0430\u0442\u043a\u0430\u0445 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"bonus\">Bonus<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u044f \u2014 \u043c\u0435\u0436\u0434\u0443 \u043a\u0443\u0440\u0441\u043e\u043c \u0440\u0443\u0431\u043b\u044f \u0438 <a href=\"https:\/\/www.quandl.com\/data\/BANKRUSSIA\/RESRV-International-Reserves\">\u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u043c\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u0430\u043c\u0438<\/a>:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/516\/f7e\/9a1\/516f7e9a1d50465e90b6cd6695dc27b4.png\" alt=\"image\"\/><br \/>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u043c\u0438, \u0442\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u0430\u0436 0.936. \u041c\u043e\u0434\u0435\u043b\u044c \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 (\u043d\u0435\u0444\u0442\u044c \u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u044b) \u0438\u043c\u0435\u0435\u0442 R<sup>2<\/sup>=0.98, \u0438, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ramsey_RESET_test\">RESET-\u0442\u0435\u0441\u0442 \u0420\u0430\u043c\u0441\u0435\u044f<\/a> \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u043d\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0442.\u0435. \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0444\u0442\u0438 \u0438 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u043c\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9db\/668\/f02\/9db668f02660f7e0a7c49239a7b1fc3a.svg\" alt=\"$ rub_i=-8.713 \\cdot 10^{-3}+1.458 \\cdot 10^{-4} \\cdot oil_i +4.648 \\cdot 10^{-8} \\cdot res_i, $\" data-tex=\"display\"\/><\/math><\/p>\n<p>  <\/p>\n<p>\u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u043e\u0442\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/daa\/e21\/462\/daae2146277110f9f94cdddaf0c1e6c1.svg\" alt=\"$ rub_i=0.0254+0.0042 \\cdot oil_i +0.0031 \\cdot res_i, $\" data-tex=\"display\"\/><\/math><\/p>\n<p> \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:\/\/habrahabr.ru\/post\/324890\/\"> https:\/\/habrahabr.ru\/post\/324890\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e10\/0e1\/5a9\/e100e15a9a3e42e4869217f10bc3132d.png\"\/><br \/>  \u041d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u043a\u0443\u0440\u0441 \u0440\u0443\u0431\u043b\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0435\u0444\u0442\u0438 (\u0438 \u043e\u0442 \u043a\u043e\u0435-\u0447\u0435\u0433\u043e \u0435\u0449\u0435). \u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412 \u0441\u0432\u043e\u0435\u0439 <a href=\"https:\/\/habrahabr.ru\/post\/233059\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043e \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438 \u044f \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0435\u0441\u0442\u044c \u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f, \u043d\u043e \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0440\u0435\u0433\u0440\u0435\u0441\u0441\u0438\u0438? \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0441\u0442 \u0438 \u043f\u043e\u043d\u044f\u0442\u0435\u043d, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b <del>(\u043d\u0435 \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435)<\/del>.<\/p>\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-284456","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284456","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=284456"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284456\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}