<?xml version="1.0" encoding="UTF-8"?>
<article article-type="research-article" dtd-version="1.3" xml:lang="ru" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://metafora.rcsi.science/xsd_files/journal3.xsd">
  <front>
    <journal-meta>
      <journal-id journal-id-type="publisher-id">moitvivt</journal-id>
      <journal-title-group>
        <journal-title xml:lang="ru">Моделирование, оптимизация и информационные технологии</journal-title>
        <trans-title-group xml:lang="en">
          <trans-title>Modeling, Optimization and Information Technology</trans-title>
        </trans-title-group>
      </journal-title-group>
      <issn pub-type="epub">2310-6018</issn>
      <publisher>
        <publisher-name>Издательство</publisher-name>
      </publisher>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.26102/2310-6018/2026.53.2.007</article-id>
      <article-id pub-id-type="custom" custom-type="elpub">2175</article-id>
      <title-group>
        <article-title xml:lang="ru">Компьютерная реализация точного распределения ранговых статистических критериев методами динамического программирования</article-title>
        <trans-title-group xml:lang="en">
          <trans-title>Computer implementation of exact distribution of rank statistical criteria using dynamic programming methods</trans-title>
        </trans-title-group>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes">
          <contrib-id contrib-id-type="orcid">0009-0009-6909-9399</contrib-id>
          <name-alternatives>
            <name name-style="eastern" xml:lang="ru">
              <surname>Агамиров</surname>
              <given-names>Левон Владимирович</given-names>
            </name>
            <name name-style="western" xml:lang="en">
              <surname>Agamirov</surname>
              <given-names>Levon Vladimirovich</given-names>
            </name>
          </name-alternatives>
          <email>itno_agamirov@mail.ru</email>
          <xref ref-type="aff">aff-1</xref>
        </contrib>
        <contrib contrib-type="author">
          <contrib-id contrib-id-type="orcid">0000-0001-9181-7726</contrib-id>
          <name-alternatives>
            <name name-style="eastern" xml:lang="ru">
              <surname>Агамиров</surname>
              <given-names>Владимир Левонович</given-names>
            </name>
            <name name-style="western" xml:lang="en">
              <surname>Agamirov</surname>
              <given-names>Vladimir Levonovich</given-names>
            </name>
          </name-alternatives>
          <email>avhere@yandex.ru</email>
          <xref ref-type="aff">aff-2</xref>
        </contrib>
        <contrib contrib-type="author">
          <contrib-id contrib-id-type="orcid">0009-0001-8496-9438</contrib-id>
          <name-alternatives>
            <name name-style="eastern" xml:lang="ru">
              <surname>Вестяк</surname>
              <given-names>Владимир Анатольевич</given-names>
            </name>
            <name name-style="western" xml:lang="en">
              <surname>Vestyak</surname>
              <given-names>Vladimir Anatolyevich</given-names>
            </name>
          </name-alternatives>
          <email>kaf311@yandex.ru</email>
          <xref ref-type="aff">aff-3</xref>
        </contrib>
        <contrib contrib-type="author">
          <contrib-id contrib-id-type="orcid">0000-0002-2851-8472</contrib-id>
          <name-alternatives>
            <name name-style="eastern" xml:lang="ru">
              <surname>Тутова</surname>
              <given-names>Наталья Владимировна</given-names>
            </name>
            <name name-style="western" xml:lang="en">
              <surname>Toutova</surname>
              <given-names>Natalia Vladimirovna</given-names>
            </name>
          </name-alternatives>
          <email>e-natasha@mail.ru</email>
          <xref ref-type="aff">aff-4</xref>
        </contrib>
      </contrib-group>
      <aff-alternatives id="aff-1">
        <aff xml:lang="ru">Московский технический университет связи и информатики Московский авиационный институт</aff>
        <aff xml:lang="en">Moscow Technical University of Communications and Informatics Moscow Aviation Institute</aff>
      </aff-alternatives>
      <aff-alternatives id="aff-2">
        <aff xml:lang="ru">Московский технический университет связи и информатики Московский авиационный институт</aff>
        <aff xml:lang="en">Moscow Technical University of Communications and Informatics Moscow Aviation Institute</aff>
      </aff-alternatives>
      <aff-alternatives id="aff-3">
        <aff xml:lang="ru">Московский авиационный институт</aff>
        <aff xml:lang="en">Moscow Aviation Institute</aff>
      </aff-alternatives>
      <aff-alternatives id="aff-4">
        <aff xml:lang="ru">Московский технический университет связи и информатики</aff>
        <aff xml:lang="en">Moscow Technical University of Communications and Informatics</aff>
      </aff-alternatives>
      <pub-date pub-type="epub">
        <day>01</day>
        <month>01</month>
        <year>2026</year>
      </pub-date>
      <volume>1</volume>
      <issue>1</issue>
      <elocation-id>10.26102/2310-6018/2026.53.2.007</elocation-id>
      <permissions>
        <copyright-statement>Copyright © Авторы, 2026</copyright-statement>
        <copyright-year>2026</copyright-year>
        <license license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/">
          <license-p>This work is licensed under a Creative Commons Attribution 4.0 International License</license-p>
        </license>
      </permissions>
      <self-uri xlink:href="https://moitvivt.ru/ru/journal/article?id=2175"/>
      <abstract xml:lang="ru">
        <p>В рамках настоящего исследования анализируется актуальная проблема, связанная с определением точных распределений для ранговых непараметрических критериев при отсутствии замкнутых аналитических решений. Классический подход, основанный на полном переборе всех возможных перестановок рангов, хотя и является теоретически точным, оказывается практически неприменимым уже для небольших объемов выборок вследствие комбинаторного взрыва числа вариантов. Прямой перебор всех возможных перестановок рангов, являющийся методом точного расчета, оказывается вычислительно неразрешимой задачей даже для выборок небольшого объема из-за комбинаторного взрыва. Рассмотрены наиболее известные ранговые непараметрические критерии, не имеющие аналитического решения для получения полной функции распределения, такие как критерии Лемана-Розенблата, Краскела-Уоллиса и Муда. Существующие аппроксимации (нормальная, хи-квадрат) часто оказываются неудовлетворительными для малых выборок. В работе предлагается эффективное решение на основе метода динамического программирования, позволяющее в сотни раз сократить вычислительные затраты по сравнению с наивной генерацией перестановок. Реализована методика, включающая генерацию последовательностей рангов, расчет статистик для каждой из них и последующую агрегацию результатов для построения функции распределения. Проведенные вычислительные эксперименты однозначно демонстрируют, что метод динамического программирования является наиболее эффективным для генерации точных распределений. Разработаны и представлены в открытом доступе программные реализации на C++ и Python, проведено их сравнительное тестирование, которое подтвердило ожидаемое лидерство C++ с точки зрения быстродействия.</p>
      </abstract>
      <trans-abstract xml:lang="en">
        <p>This paper considers the problem of calculating exact distributions for nonparametric rank tests in the absence of analytical solutions. The classical approach based on a complete enumeration of all possible permutations of ranks, although theoretically accurate, turns out to be practically inapplicable even for small sample sizes due to the combinatorial explosion of the number of variants. A straightforward enumeration of all possible rank permutations, which is an exact calculation method, proves computationally intractable even for small samples due to combinatorial explosion. The most well-known nonparametric rank tests lacking an analytical solution for obtaining the full distribution function are considered, including the Lehmann-Rosenblatt, Kruskal-Wallis, and Mood tests. Existing approximations (normal, chi-square) often prove unsatisfactory for small samples. This paper proposes an efficient solution based on dynamic programming, which reduces computational costs by hundreds of times compared to naive permutation generation. The methodology implemented includes generating rank sequences, calculating statistics for each sequence, and then aggregating the results to construct the distribution function. Computational experiments conducted clearly demonstrate that dynamic programming is the most effective method for generating accurate distributions. Software implementations in C++ and Python have been developed and made publicly available, and comparative testing has confirmed the expected performance advantage of C++.</p>
      </trans-abstract>
      <kwd-group xml:lang="ru">
        <kwd>непараметрическая статистика</kwd>
        <kwd>ранговые критерии</kwd>
        <kwd>точное распределение</kwd>
        <kwd>p-value</kwd>
        <kwd>динамическое программирование</kwd>
        <kwd>вычислительная эффективность</kwd>
        <kwd>открытый код</kwd>
      </kwd-group>
      <kwd-group xml:lang="en">
        <kwd>nonparametric statistics</kwd>
        <kwd>rank tests</kwd>
        <kwd>exact distribution</kwd>
        <kwd>p-value</kwd>
        <kwd>dynamic programming</kwd>
        <kwd>computational efficiency</kwd>
        <kwd>open source</kwd>
      </kwd-group>
      <funding-group>
        <funding-statement xml:lang="ru">Исследование выполнено без спонсорской поддержки.</funding-statement>
        <funding-statement xml:lang="en">The study was performed without external funding.</funding-statement>
      </funding-group>
    </article-meta>
  </front>
  <back>
    <ref-list>
      <title>References</title>
      <ref id="cit1">
        <label>1</label>
        <mixed-citation xml:lang="ru">Агамиров Л.В., Агамиров В.Л., Вестяк В.А. Численные методы и алгоритмы расчета точных распределений непараметрических критериев проверки статистических гипотез. Вестник Московского авиационного института. 2013;20(4):212–218.</mixed-citation>
      </ref>
      <ref id="cit2">
        <label>2</label>
        <mixed-citation xml:lang="ru">Van de Wiel M.A. The Probability Generating Function of the Freund-Ansari-Bradley Statistic. In: Memorandum COSOR: Volume 9711. Eindhoven: Technische Universiteit Eindhoven; 1997. P. 6–13.</mixed-citation>
      </ref>
      <ref id="cit3">
        <label>3</label>
        <mixed-citation xml:lang="ru">Van de Wiel M.A. Exact Distributions of Multiple Comparisons Rank Statistics. Journal of the American Statistical Association. 2002;97(460):1081–1089. https://doi.org/10.1198/016214502388618898</mixed-citation>
      </ref>
      <ref id="cit4">
        <label>4</label>
        <mixed-citation xml:lang="ru">Choi W., Lee J.W., Huh M.-H., Kang S.-H. An Algorithm for Computing the Exact Distribution of the Kruskal-Wallis Test. Communications in Statistics – Simulation and Computation. 2003;32(4):1029–1040. https://doi.org/10.1081/SAC-120023876</mixed-citation>
      </ref>
      <ref id="cit5">
        <label>5</label>
        <mixed-citation xml:lang="ru">Meyer J.P., Seaman M.A. A Comparison of the Exact Kruskal-Wallis Distribution to Asymptotic Approximations for All Sample Sizes up to 105. The Journal of Experimental Education. 2013;81(2):139–156. https://doi.org/10.1080/00220973.2012.699904</mixed-citation>
      </ref>
      <ref id="cit6">
        <label>6</label>
        <mixed-citation xml:lang="ru">Холлендер М., Вулф Д. Непараметрические методы статистики. Москва: Финансы и статистика; 1983. 518 c.</mixed-citation>
      </ref>
      <ref id="cit7">
        <label>7</label>
        <mixed-citation xml:lang="ru">Odiase J.I., Ogbonmwan S.M. JMASM20: Exact Permutation Critical Values for The Kruskal-Wallis One-Way ANOVA. Journal of Modern Applied Statistical Methods. 2005;4(2). https://doi.org/10.22237/jmasm/1130804820</mixed-citation>
      </ref>
      <ref id="cit8">
        <label>8</label>
        <mixed-citation xml:lang="ru">Spurrier J.D. On the Null Distribution of the Kruskal-Wallis Statistic. Journal of Nonparametric Statistics. 2003;15(6):685–691. https://doi.org/10.1080/10485250310001634719</mixed-citation>
      </ref>
      <ref id="cit9">
        <label>9</label>
        <mixed-citation xml:lang="ru">Streitberg B., Rohmel J. Exact Distributions for Permutation and Rank Tests: An Introduction to Some Recently Published Algorithms. Statistical Software Newsletter. 1986;12(1):10–17.</mixed-citation>
      </ref>
      <ref id="cit10">
        <label>10</label>
        <mixed-citation xml:lang="ru">Divine G.W., Norton H.J., Barón A.E., Juarez-Colunga E. The Wilcoxon-Mann-Whitney Procedure Fails as a Test of Medians. The American Statistician. 2018;72(3):278–286. https://doi.org/10.1080/00031305.2017.1305291</mixed-citation>
      </ref>
      <ref id="cit11">
        <label>11</label>
        <mixed-citation xml:lang="ru">Hothorn T., Hornik K., van de Wiel M.A., Zeileis A. Implementing a Class of Permutation Tests: The Coin Package. Journal of Statistical Software. 2008;28(8):1–23. https://doi.org/10.18637/jss.v028.i08</mixed-citation>
      </ref>
      <ref id="cit12">
        <label>12</label>
        <mixed-citation xml:lang="ru">Антипина Н.М., Захаров В.Н., Протасов Ю.М., Юров В.М. Непараметрический критерий различия для двух связанных выборок в табличном редакторе MS Excel. Вестник Московского государственного областного университета Серия: Экономика. 2021;(2):47–55. https://doi.org/10.18384/2310-6646-2021-2-47-55</mixed-citation>
      </ref>
      <ref id="cit13">
        <label>13</label>
        <mixed-citation xml:lang="ru">Lehmann E.L. Testing Statistical Hypothesis. New York: Wiley; 1986. 600 p.</mixed-citation>
      </ref>
      <ref id="cit14">
        <label>14</label>
        <mixed-citation xml:lang="ru">Хеттманспергер Т. Статистические выводы, основанные на рангах. Москва: Финансы и статистика; 1987. 334 с.</mixed-citation>
      </ref>
      <ref id="cit15">
        <label>15</label>
        <mixed-citation xml:lang="ru">Кобзарь А.И. Прикладная математическая статистика. Для инженеров и научных работников. Москва: ФИЗМАТЛИТ; 2006. 816 с.</mixed-citation>
      </ref>
      <ref id="cit16">
        <label>16</label>
        <mixed-citation xml:lang="ru">Iman R.L., Davenport J.M. New approximations to the exact distribution of the kruskal-wallis test statistic. Communications in Statistics – Theory and Methods. 1976;5(14):1335–1348. https://doi.org/10.1080/03610927608827446</mixed-citation>
      </ref>
      <ref id="cit17">
        <label>17</label>
        <mixed-citation xml:lang="ru">Mood A.M. On the Asymptotic Efficiency of Certain Nonparametric Two-Sample Tests. The Annals of Mathematical Statistics. 1954;25(3):514–522.</mixed-citation>
      </ref>
      <ref id="cit18">
        <label>18</label>
        <mixed-citation xml:lang="ru">Ansari A.R., Bradley R.A. Rank-Sum Tests for Dispersions. The Annals of Mathematical Statistics. 1960;31(4):1174–1189.</mixed-citation>
      </ref>
    </ref-list>
    <fn-group>
      <fn fn-type="conflict">
        <p>The authors declare that there are no conflicts of interest present.</p>
      </fn>
    </fn-group>
  </back>
</article>