commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r951633 [5/49] - in /websites/production/commons/content/proper/commons-math: xref-test/ xref-test/org/apache/commons/math3/ xref-test/org/apache/commons/math3/analysis/ xref-test/org/apache/commons/math3/analysis/differentiation/ xref-test...
Date Sun, 17 May 2015 17:05:54 GMT
Modified: websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/distribution/BetaDistributionTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/distribution/BetaDistributionTest.html (original)
+++ websites/production/commons/content/proper/commons-math/xref-test/org/apache/commons/math3/distribution/BetaDistributionTest.html Sun May 17 17:05:50 2015
@@ -24,294 +24,367 @@
 <a class="jxr_linenumber" name="L16" href="#L16">16</a>  <em class="jxr_comment"> */</em>
 <a class="jxr_linenumber" name="L17" href="#L17">17</a>  <strong class="jxr_keyword">package</strong> org.apache.commons.math3.distribution;
 <a class="jxr_linenumber" name="L18" href="#L18">18</a>  
-<a class="jxr_linenumber" name="L19" href="#L19">19</a>  <strong class="jxr_keyword">import</strong> org.junit.Assert;
-<a class="jxr_linenumber" name="L20" href="#L20">20</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
-<a class="jxr_linenumber" name="L21" href="#L21">21</a>  
-<a class="jxr_linenumber" name="L22" href="#L22">22</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/commons/math3/distribution/BetaDistributionTest.html">BetaDistributionTest</a> {
-<a class="jxr_linenumber" name="L23" href="#L23">23</a>      @Test
-<a class="jxr_linenumber" name="L24" href="#L24">24</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCumulative() {
-<a class="jxr_linenumber" name="L25" href="#L25">25</a>          <strong class="jxr_keyword">double</strong>[] x = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{-0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1};
-<a class="jxr_linenumber" name="L26" href="#L26">26</a>          <em class="jxr_comment">// all test data computed using R 2.5</em>
-<a class="jxr_linenumber" name="L27" href="#L27">27</a>          checkCumulative(0.1, 0.1,
-<a class="jxr_linenumber" name="L28" href="#L28">28</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L29" href="#L29">29</a>                  0.0000000000, 0.0000000000, 0.4063850939, 0.4397091902, 0.4628041861,
-<a class="jxr_linenumber" name="L30" href="#L30">30</a>                  0.4821200456, 0.5000000000, 0.5178799544, 0.5371958139, 0.5602908098,
-<a class="jxr_linenumber" name="L31" href="#L31">31</a>                  0.5936149061, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L32" href="#L32">32</a>          checkCumulative(0.1, 0.5,
-<a class="jxr_linenumber" name="L33" href="#L33">33</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L34" href="#L34">34</a>                  0.0000000000, 0.0000000000, 0.7048336221, 0.7593042194, 0.7951765304,
-<a class="jxr_linenumber" name="L35" href="#L35">35</a>                  0.8234948385, 0.8480017124, 0.8706034370, 0.8926585878, 0.9156406404,
-<a class="jxr_linenumber" name="L36" href="#L36">36</a>                  0.9423662883, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L37" href="#L37">37</a>          checkCumulative(0.1, 1.0,
-<a class="jxr_linenumber" name="L38" href="#L38">38</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L39" href="#L39">39</a>                  0.0000000000, 0.0000000000, 0.7943282347, 0.8513399225, 0.8865681506,
-<a class="jxr_linenumber" name="L40" href="#L40">40</a>                  0.9124435366, 0.9330329915, 0.9502002165, 0.9649610951, 0.9779327685,
-<a class="jxr_linenumber" name="L41" href="#L41">41</a>                  0.9895192582, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L42" href="#L42">42</a>          checkCumulative(0.1, 2.0,
-<a class="jxr_linenumber" name="L43" href="#L43">43</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L44" href="#L44">44</a>                  0.0000000000, 0.0000000000, 0.8658177758, 0.9194471163, 0.9486279211,
-<a class="jxr_linenumber" name="L45" href="#L45">45</a>                  0.9671901487, 0.9796846411, 0.9882082252, 0.9939099280, 0.9974914239,
-<a class="jxr_linenumber" name="L46" href="#L46">46</a>                  0.9994144508, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L47" href="#L47">47</a>          checkCumulative(0.1, 4.0,
-<a class="jxr_linenumber" name="L48" href="#L48">48</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L49" href="#L49">49</a>                  0.0000000000, 0.0000000000, 0.9234991121, 0.9661958941, 0.9842285085,
-<a class="jxr_linenumber" name="L50" href="#L50">50</a>                  0.9928444112, 0.9970040660, 0.9989112804, 0.9996895625, 0.9999440793,
-<a class="jxr_linenumber" name="L51" href="#L51">51</a>                  0.9999967829, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L52" href="#L52">52</a>          checkCumulative(0.5, 0.1,
-<a class="jxr_linenumber" name="L53" href="#L53">53</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L54" href="#L54">54</a>                  0.00000000000, 0.00000000000, 0.05763371168, 0.08435935962,
-<a class="jxr_linenumber" name="L55" href="#L55">55</a>                  0.10734141216, 0.12939656302, 0.15199828760, 0.17650516146,
-<a class="jxr_linenumber" name="L56" href="#L56">56</a>                  0.20482346963, 0.24069578055, 0.29516637795, 1.00000000000, 1.00000000000});
-<a class="jxr_linenumber" name="L57" href="#L57">57</a>  
-<a class="jxr_linenumber" name="L58" href="#L58">58</a>          checkCumulative(0.5, 0.5,
-<a class="jxr_linenumber" name="L59" href="#L59">59</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L60" href="#L60">60</a>                  0.0000000000, 0.0000000000, 0.2048327647, 0.2951672353, 0.3690101196,
-<a class="jxr_linenumber" name="L61" href="#L61">61</a>                  0.4359057832, 0.5000000000, 0.5640942168, 0.6309898804, 0.7048327647,
-<a class="jxr_linenumber" name="L62" href="#L62">62</a>                  0.7951672353, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L63" href="#L63">63</a>          checkCumulative(0.5, 1.0,
-<a class="jxr_linenumber" name="L64" href="#L64">64</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L65" href="#L65">65</a>                  0.0000000000, 0.0000000000, 0.3162277660, 0.4472135955, 0.5477225575,
-<a class="jxr_linenumber" name="L66" href="#L66">66</a>                  0.6324555320, 0.7071067812, 0.7745966692, 0.8366600265, 0.8944271910,
-<a class="jxr_linenumber" name="L67" href="#L67">67</a>                  0.9486832981, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L68" href="#L68">68</a>          checkCumulative(0.5, 2.0,
-<a class="jxr_linenumber" name="L69" href="#L69">69</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L70" href="#L70">70</a>                  0.0000000000, 0.0000000000, 0.4585302607, 0.6260990337, 0.7394254526,
-<a class="jxr_linenumber" name="L71" href="#L71">71</a>                  0.8221921916, 0.8838834765, 0.9295160031, 0.9621590305, 0.9838699101,
-<a class="jxr_linenumber" name="L72" href="#L72">72</a>                  0.9961174630, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L73" href="#L73">73</a>          checkCumulative(0.5, 4.0,
-<a class="jxr_linenumber" name="L74" href="#L74">74</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L75" href="#L75">75</a>                  0.0000000000, 0.0000000000, 0.6266250826, 0.8049844719, 0.8987784842,
-<a class="jxr_linenumber" name="L76" href="#L76">76</a>                  0.9502644369, 0.9777960959, 0.9914837366, 0.9974556254, 0.9995223859,
-<a class="jxr_linenumber" name="L77" href="#L77">77</a>                  0.9999714889, 1.0000000000, 1.0000000000});
-<a class="jxr_linenumber" name="L78" href="#L78">78</a>          checkCumulative(1.0, 0.1,
-<a class="jxr_linenumber" name="L79" href="#L79">79</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L80" href="#L80">80</a>                  0.00000000000, 0.00000000000, 0.01048074179, 0.02206723146,
-<a class="jxr_linenumber" name="L81" href="#L81">81</a>                  0.03503890488, 0.04979978349, 0.06696700846, 0.08755646344,
-<a class="jxr_linenumber" name="L82" href="#L82">82</a>                  0.11343184943, 0.14866007748, 0.20567176528, 1.00000000000, 1.00000000000});
-<a class="jxr_linenumber" name="L83" href="#L83">83</a>          checkCumulative(1.0, 0.5,
-<a class="jxr_linenumber" name="L84" href="#L84">84</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L85" href="#L85">85</a>                  0.00000000000, 0.00000000000, 0.05131670195, 0.10557280900,
-<a class="jxr_linenumber" name="L86" href="#L86">86</a>                  0.16333997347, 0.22540333076, 0.29289321881, 0.36754446797,
-<a class="jxr_linenumber" name="L87" href="#L87">87</a>                  0.45227744249, 0.55278640450, 0.68377223398, 1.00000000000, 1.00000000000});
-<a class="jxr_linenumber" name="L88" href="#L88">88</a>          checkCumulative(1, 1,
-<a class="jxr_linenumber" name="L89" href="#L89">89</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L90" href="#L90">90</a>                  0.0, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0});
-<a class="jxr_linenumber" name="L91" href="#L91">91</a>          checkCumulative(1, 2,
-<a class="jxr_linenumber" name="L92" href="#L92">92</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L93" href="#L93">93</a>                  0.00, 0.00, 0.19, 0.36, 0.51, 0.64, 0.75, 0.84, 0.91, 0.96, 0.99, 1.00, 1.00});
-<a class="jxr_linenumber" name="L94" href="#L94">94</a>          checkCumulative(1, 4,
-<a class="jxr_linenumber" name="L95" href="#L95">95</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L96" href="#L96">96</a>                  0.0000, 0.0000, 0.3439, 0.5904, 0.7599, 0.8704, 0.9375, 0.9744, 0.9919,
-<a class="jxr_linenumber" name="L97" href="#L97">97</a>                  0.9984, 0.9999, 1.0000, 1.0000});
-<a class="jxr_linenumber" name="L98" href="#L98">98</a>          checkCumulative(2.0, 0.1,
-<a class="jxr_linenumber" name="L99" href="#L99">99</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L100" href="#L100">100</a>                 0.0000000000000, 0.0000000000000, 0.0005855492117, 0.0025085760862,
-<a class="jxr_linenumber" name="L101" href="#L101">101</a>                 0.0060900720266, 0.0117917748341, 0.0203153588864, 0.0328098512512,
-<a class="jxr_linenumber" name="L102" href="#L102">102</a>                 0.0513720788952, 0.0805528836776, 0.1341822241505, 1.0000000000000, 1.0000000000000});
-<a class="jxr_linenumber" name="L103" href="#L103">103</a>         checkCumulative(2, 1,
+<a class="jxr_linenumber" name="L19" href="#L19">19</a>  <strong class="jxr_keyword">import</strong> java.util.Arrays;
+<a class="jxr_linenumber" name="L20" href="#L20">20</a>  
+<a class="jxr_linenumber" name="L21" href="#L21">21</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.random.RandomGenerator;
+<a class="jxr_linenumber" name="L22" href="#L22">22</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.random.Well1024a;
+<a class="jxr_linenumber" name="L23" href="#L23">23</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.random.Well19937a;
+<a class="jxr_linenumber" name="L24" href="#L24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.stat.StatUtils;
+<a class="jxr_linenumber" name="L25" href="#L25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest;
+<a class="jxr_linenumber" name="L26" href="#L26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.math3.stat.inference.TestUtils;
+<a class="jxr_linenumber" name="L27" href="#L27">27</a>  <strong class="jxr_keyword">import</strong> org.junit.Assert;
+<a class="jxr_linenumber" name="L28" href="#L28">28</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
+<a class="jxr_linenumber" name="L29" href="#L29">29</a>  
+<a class="jxr_linenumber" name="L30" href="#L30">30</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/commons/math3/distribution/BetaDistributionTest.html">BetaDistributionTest</a> {
+<a class="jxr_linenumber" name="L31" href="#L31">31</a>  
+<a class="jxr_linenumber" name="L32" href="#L32">32</a>      <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] alphaBetas = {0.1, 1, 10, 100, 1000};
+<a class="jxr_linenumber" name="L33" href="#L33">33</a>      <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> epsilon = StatUtils.min(alphaBetas);
+<a class="jxr_linenumber" name="L34" href="#L34">34</a>  
+<a class="jxr_linenumber" name="L35" href="#L35">35</a>      @Test
+<a class="jxr_linenumber" name="L36" href="#L36">36</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCumulative() {
+<a class="jxr_linenumber" name="L37" href="#L37">37</a>          <strong class="jxr_keyword">double</strong>[] x = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{-0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1};
+<a class="jxr_linenumber" name="L38" href="#L38">38</a>          <em class="jxr_comment">// all test data computed using R 2.5</em>
+<a class="jxr_linenumber" name="L39" href="#L39">39</a>          checkCumulative(0.1, 0.1,
+<a class="jxr_linenumber" name="L40" href="#L40">40</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L41" href="#L41">41</a>                  0.0000000000, 0.0000000000, 0.4063850939, 0.4397091902, 0.4628041861,
+<a class="jxr_linenumber" name="L42" href="#L42">42</a>                  0.4821200456, 0.5000000000, 0.5178799544, 0.5371958139, 0.5602908098,
+<a class="jxr_linenumber" name="L43" href="#L43">43</a>                  0.5936149061, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L44" href="#L44">44</a>          checkCumulative(0.1, 0.5,
+<a class="jxr_linenumber" name="L45" href="#L45">45</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L46" href="#L46">46</a>                  0.0000000000, 0.0000000000, 0.7048336221, 0.7593042194, 0.7951765304,
+<a class="jxr_linenumber" name="L47" href="#L47">47</a>                  0.8234948385, 0.8480017124, 0.8706034370, 0.8926585878, 0.9156406404,
+<a class="jxr_linenumber" name="L48" href="#L48">48</a>                  0.9423662883, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L49" href="#L49">49</a>          checkCumulative(0.1, 1.0,
+<a class="jxr_linenumber" name="L50" href="#L50">50</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L51" href="#L51">51</a>                  0.0000000000, 0.0000000000, 0.7943282347, 0.8513399225, 0.8865681506,
+<a class="jxr_linenumber" name="L52" href="#L52">52</a>                  0.9124435366, 0.9330329915, 0.9502002165, 0.9649610951, 0.9779327685,
+<a class="jxr_linenumber" name="L53" href="#L53">53</a>                  0.9895192582, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L54" href="#L54">54</a>          checkCumulative(0.1, 2.0,
+<a class="jxr_linenumber" name="L55" href="#L55">55</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L56" href="#L56">56</a>                  0.0000000000, 0.0000000000, 0.8658177758, 0.9194471163, 0.9486279211,
+<a class="jxr_linenumber" name="L57" href="#L57">57</a>                  0.9671901487, 0.9796846411, 0.9882082252, 0.9939099280, 0.9974914239,
+<a class="jxr_linenumber" name="L58" href="#L58">58</a>                  0.9994144508, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L59" href="#L59">59</a>          checkCumulative(0.1, 4.0,
+<a class="jxr_linenumber" name="L60" href="#L60">60</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L61" href="#L61">61</a>                  0.0000000000, 0.0000000000, 0.9234991121, 0.9661958941, 0.9842285085,
+<a class="jxr_linenumber" name="L62" href="#L62">62</a>                  0.9928444112, 0.9970040660, 0.9989112804, 0.9996895625, 0.9999440793,
+<a class="jxr_linenumber" name="L63" href="#L63">63</a>                  0.9999967829, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L64" href="#L64">64</a>          checkCumulative(0.5, 0.1,
+<a class="jxr_linenumber" name="L65" href="#L65">65</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L66" href="#L66">66</a>                  0.00000000000, 0.00000000000, 0.05763371168, 0.08435935962,
+<a class="jxr_linenumber" name="L67" href="#L67">67</a>                  0.10734141216, 0.12939656302, 0.15199828760, 0.17650516146,
+<a class="jxr_linenumber" name="L68" href="#L68">68</a>                  0.20482346963, 0.24069578055, 0.29516637795, 1.00000000000, 1.00000000000});
+<a class="jxr_linenumber" name="L69" href="#L69">69</a>  
+<a class="jxr_linenumber" name="L70" href="#L70">70</a>          checkCumulative(0.5, 0.5,
+<a class="jxr_linenumber" name="L71" href="#L71">71</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L72" href="#L72">72</a>                  0.0000000000, 0.0000000000, 0.2048327647, 0.2951672353, 0.3690101196,
+<a class="jxr_linenumber" name="L73" href="#L73">73</a>                  0.4359057832, 0.5000000000, 0.5640942168, 0.6309898804, 0.7048327647,
+<a class="jxr_linenumber" name="L74" href="#L74">74</a>                  0.7951672353, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L75" href="#L75">75</a>          checkCumulative(0.5, 1.0,
+<a class="jxr_linenumber" name="L76" href="#L76">76</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L77" href="#L77">77</a>                  0.0000000000, 0.0000000000, 0.3162277660, 0.4472135955, 0.5477225575,
+<a class="jxr_linenumber" name="L78" href="#L78">78</a>                  0.6324555320, 0.7071067812, 0.7745966692, 0.8366600265, 0.8944271910,
+<a class="jxr_linenumber" name="L79" href="#L79">79</a>                  0.9486832981, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L80" href="#L80">80</a>          checkCumulative(0.5, 2.0,
+<a class="jxr_linenumber" name="L81" href="#L81">81</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L82" href="#L82">82</a>                  0.0000000000, 0.0000000000, 0.4585302607, 0.6260990337, 0.7394254526,
+<a class="jxr_linenumber" name="L83" href="#L83">83</a>                  0.8221921916, 0.8838834765, 0.9295160031, 0.9621590305, 0.9838699101,
+<a class="jxr_linenumber" name="L84" href="#L84">84</a>                  0.9961174630, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L85" href="#L85">85</a>          checkCumulative(0.5, 4.0,
+<a class="jxr_linenumber" name="L86" href="#L86">86</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L87" href="#L87">87</a>                  0.0000000000, 0.0000000000, 0.6266250826, 0.8049844719, 0.8987784842,
+<a class="jxr_linenumber" name="L88" href="#L88">88</a>                  0.9502644369, 0.9777960959, 0.9914837366, 0.9974556254, 0.9995223859,
+<a class="jxr_linenumber" name="L89" href="#L89">89</a>                  0.9999714889, 1.0000000000, 1.0000000000});
+<a class="jxr_linenumber" name="L90" href="#L90">90</a>          checkCumulative(1.0, 0.1,
+<a class="jxr_linenumber" name="L91" href="#L91">91</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L92" href="#L92">92</a>                  0.00000000000, 0.00000000000, 0.01048074179, 0.02206723146,
+<a class="jxr_linenumber" name="L93" href="#L93">93</a>                  0.03503890488, 0.04979978349, 0.06696700846, 0.08755646344,
+<a class="jxr_linenumber" name="L94" href="#L94">94</a>                  0.11343184943, 0.14866007748, 0.20567176528, 1.00000000000, 1.00000000000});
+<a class="jxr_linenumber" name="L95" href="#L95">95</a>          checkCumulative(1.0, 0.5,
+<a class="jxr_linenumber" name="L96" href="#L96">96</a>                  x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L97" href="#L97">97</a>                  0.00000000000, 0.00000000000, 0.05131670195, 0.10557280900,
+<a class="jxr_linenumber" name="L98" href="#L98">98</a>                  0.16333997347, 0.22540333076, 0.29289321881, 0.36754446797,
+<a class="jxr_linenumber" name="L99" href="#L99">99</a>                  0.45227744249, 0.55278640450, 0.68377223398, 1.00000000000, 1.00000000000});
+<a class="jxr_linenumber" name="L100" href="#L100">100</a>         checkCumulative(1, 1,
+<a class="jxr_linenumber" name="L101" href="#L101">101</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L102" href="#L102">102</a>                 0.0, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0});
+<a class="jxr_linenumber" name="L103" href="#L103">103</a>         checkCumulative(1, 2,
 <a class="jxr_linenumber" name="L104" href="#L104">104</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L105" href="#L105">105</a>                 0.00, 0.00, 0.01, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1.00, 1.00});
-<a class="jxr_linenumber" name="L106" href="#L106">106</a>         checkCumulative(2.0, 0.5,
+<a class="jxr_linenumber" name="L105" href="#L105">105</a>                 0.00, 0.00, 0.19, 0.36, 0.51, 0.64, 0.75, 0.84, 0.91, 0.96, 0.99, 1.00, 1.00});
+<a class="jxr_linenumber" name="L106" href="#L106">106</a>         checkCumulative(1, 4,
 <a class="jxr_linenumber" name="L107" href="#L107">107</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L108" href="#L108">108</a>                 0.000000000000, 0.000000000000, 0.003882537047, 0.016130089900,
-<a class="jxr_linenumber" name="L109" href="#L109">109</a>                 0.037840969486, 0.070483996910, 0.116116523517, 0.177807808356,
-<a class="jxr_linenumber" name="L110" href="#L110">110</a>                 0.260574547368, 0.373900966300, 0.541469739276, 1.000000000000, 1.000000000000});
-<a class="jxr_linenumber" name="L111" href="#L111">111</a>         checkCumulative(2, 2,
-<a class="jxr_linenumber" name="L112" href="#L112">112</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L113" href="#L113">113</a>                 0.000, 0.000, 0.028, 0.104, 0.216, 0.352, 0.500, 0.648, 0.784, 0.896, 0.972, 1.000, 1.000});
-<a class="jxr_linenumber" name="L114" href="#L114">114</a>         checkCumulative(2, 4,
-<a class="jxr_linenumber" name="L115" href="#L115">115</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L116" href="#L116">116</a>                 0.00000, 0.00000, 0.08146, 0.26272, 0.47178, 0.66304, 0.81250, 0.91296,
-<a class="jxr_linenumber" name="L117" href="#L117">117</a>                 0.96922, 0.99328, 0.99954, 1.00000, 1.00000});
-<a class="jxr_linenumber" name="L118" href="#L118">118</a>         checkCumulative(4.0, 0.1,
+<a class="jxr_linenumber" name="L108" href="#L108">108</a>                 0.0000, 0.0000, 0.3439, 0.5904, 0.7599, 0.8704, 0.9375, 0.9744, 0.9919,
+<a class="jxr_linenumber" name="L109" href="#L109">109</a>                 0.9984, 0.9999, 1.0000, 1.0000});
+<a class="jxr_linenumber" name="L110" href="#L110">110</a>         checkCumulative(2.0, 0.1,
+<a class="jxr_linenumber" name="L111" href="#L111">111</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L112" href="#L112">112</a>                 0.0000000000000, 0.0000000000000, 0.0005855492117, 0.0025085760862,
+<a class="jxr_linenumber" name="L113" href="#L113">113</a>                 0.0060900720266, 0.0117917748341, 0.0203153588864, 0.0328098512512,
+<a class="jxr_linenumber" name="L114" href="#L114">114</a>                 0.0513720788952, 0.0805528836776, 0.1341822241505, 1.0000000000000, 1.0000000000000});
+<a class="jxr_linenumber" name="L115" href="#L115">115</a>         checkCumulative(2, 1,
+<a class="jxr_linenumber" name="L116" href="#L116">116</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L117" href="#L117">117</a>                 0.00, 0.00, 0.01, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1.00, 1.00});
+<a class="jxr_linenumber" name="L118" href="#L118">118</a>         checkCumulative(2.0, 0.5,
 <a class="jxr_linenumber" name="L119" href="#L119">119</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L120" href="#L120">120</a>                 0.000000000e+00, 0.000000000e+00, 3.217128269e-06, 5.592070271e-05,
-<a class="jxr_linenumber" name="L121" href="#L121">121</a>                 3.104375474e-04, 1.088719595e-03, 2.995933981e-03, 7.155588777e-03,
-<a class="jxr_linenumber" name="L122" href="#L122">122</a>                 1.577149153e-02, 3.380410585e-02, 7.650088789e-02, 1.000000000e+00, 1.000000000e+00});
-<a class="jxr_linenumber" name="L123" href="#L123">123</a>         checkCumulative(4.0, 0.5,
+<a class="jxr_linenumber" name="L120" href="#L120">120</a>                 0.000000000000, 0.000000000000, 0.003882537047, 0.016130089900,
+<a class="jxr_linenumber" name="L121" href="#L121">121</a>                 0.037840969486, 0.070483996910, 0.116116523517, 0.177807808356,
+<a class="jxr_linenumber" name="L122" href="#L122">122</a>                 0.260574547368, 0.373900966300, 0.541469739276, 1.000000000000, 1.000000000000});
+<a class="jxr_linenumber" name="L123" href="#L123">123</a>         checkCumulative(2, 2,
 <a class="jxr_linenumber" name="L124" href="#L124">124</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L125" href="#L125">125</a>                 0.000000000e+00, 0.000000000e+00, 2.851114863e-05, 4.776140576e-04,
-<a class="jxr_linenumber" name="L126" href="#L126">126</a>                 2.544374616e-03, 8.516263371e-03, 2.220390414e-02, 4.973556312e-02,
-<a class="jxr_linenumber" name="L127" href="#L127">127</a>                 1.012215158e-01, 1.950155281e-01, 3.733749174e-01, 1.000000000e+00, 1.000000000e+00});
-<a class="jxr_linenumber" name="L128" href="#L128">128</a>         checkCumulative(4, 1,
-<a class="jxr_linenumber" name="L129" href="#L129">129</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L130" href="#L130">130</a>                 0.0000, 0.0000, 0.0001, 0.0016, 0.0081, 0.0256, 0.0625, 0.1296, 0.2401,
-<a class="jxr_linenumber" name="L131" href="#L131">131</a>                 0.4096, 0.6561, 1.0000, 1.0000});
-<a class="jxr_linenumber" name="L132" href="#L132">132</a>         checkCumulative(4, 2,
-<a class="jxr_linenumber" name="L133" href="#L133">133</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L134" href="#L134">134</a>                 0.00000, 0.00000, 0.00046, 0.00672, 0.03078, 0.08704, 0.18750, 0.33696,
-<a class="jxr_linenumber" name="L135" href="#L135">135</a>                 0.52822, 0.73728, 0.91854, 1.00000, 1.00000});
-<a class="jxr_linenumber" name="L136" href="#L136">136</a>         checkCumulative(4, 4,
-<a class="jxr_linenumber" name="L137" href="#L137">137</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L138" href="#L138">138</a>                 0.000000, 0.000000, 0.002728, 0.033344, 0.126036, 0.289792, 0.500000,
-<a class="jxr_linenumber" name="L139" href="#L139">139</a>                 0.710208, 0.873964, 0.966656, 0.997272, 1.000000, 1.000000});
-<a class="jxr_linenumber" name="L140" href="#L140">140</a> 
-<a class="jxr_linenumber" name="L141" href="#L141">141</a>     }
-<a class="jxr_linenumber" name="L142" href="#L142">142</a> 
-<a class="jxr_linenumber" name="L143" href="#L143">143</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkCumulative(<strong class="jxr_keyword">double</strong> alpha, <strong class="jxr_keyword">double</strong> beta, <strong class="jxr_keyword">double</strong>[] x, <strong class="jxr_keyword">double</strong>[] cumes) {
-<a class="jxr_linenumber" name="L144" href="#L144">144</a>         BetaDistribution d = <strong class="jxr_keyword">new</strong> BetaDistribution(alpha, beta);
-<a class="jxr_linenumber" name="L145" href="#L145">145</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; x.length; i++) {
-<a class="jxr_linenumber" name="L146" href="#L146">146</a>             Assert.assertEquals(cumes[i], d.cumulativeProbability(x[i]), 1e-8);
-<a class="jxr_linenumber" name="L147" href="#L147">147</a>         }
-<a class="jxr_linenumber" name="L148" href="#L148">148</a> 
-<a class="jxr_linenumber" name="L149" href="#L149">149</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt; x.length - 1; i++) {
-<a class="jxr_linenumber" name="L150" href="#L150">150</a>             Assert.assertEquals(x[i], d.inverseCumulativeProbability(cumes[i]), 1e-5);
-<a class="jxr_linenumber" name="L151" href="#L151">151</a>         }
-<a class="jxr_linenumber" name="L152" href="#L152">152</a>     }
-<a class="jxr_linenumber" name="L153" href="#L153">153</a> 
-<a class="jxr_linenumber" name="L154" href="#L154">154</a>     @Test
-<a class="jxr_linenumber" name="L155" href="#L155">155</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDensity() {
-<a class="jxr_linenumber" name="L156" href="#L156">156</a>         <strong class="jxr_keyword">double</strong>[] x = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1e-6, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
-<a class="jxr_linenumber" name="L157" href="#L157">157</a>         checkDensity(0.1, 0.1,
-<a class="jxr_linenumber" name="L158" href="#L158">158</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L159" href="#L159">159</a>                 12741.2357380649, 0.4429889586665234, 2.639378715e-01, 2.066393611e-01,
-<a class="jxr_linenumber" name="L160" href="#L160">160</a>                 1.832401831e-01, 1.766302780e-01, 1.832404579e-01, 2.066400696e-01,
-<a class="jxr_linenumber" name="L161" href="#L161">161</a>                 2.639396531e-01, 4.429925026e-01});
-<a class="jxr_linenumber" name="L162" href="#L162">162</a>         checkDensity(0.1, 0.5,
-<a class="jxr_linenumber" name="L163" href="#L163">163</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L164" href="#L164">164</a>                 2.218377102e+04, 7.394524202e-01, 4.203020268e-01, 3.119435533e-01,
-<a class="jxr_linenumber" name="L165" href="#L165">165</a>                 2.600787829e-01, 2.330648626e-01, 2.211408259e-01, 2.222728708e-01,
-<a class="jxr_linenumber" name="L166" href="#L166">166</a>                 2.414013907e-01, 3.070567405e-01});
-<a class="jxr_linenumber" name="L167" href="#L167">167</a>         checkDensity(0.1, 1.0,
-<a class="jxr_linenumber" name="L168" href="#L168">168</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L169" href="#L169">169</a>                 2.511886432e+04, 7.943210858e-01, 4.256680458e-01, 2.955218303e-01,
-<a class="jxr_linenumber" name="L170" href="#L170">170</a>                 2.281103709e-01, 1.866062624e-01, 1.583664652e-01, 1.378514078e-01,
-<a class="jxr_linenumber" name="L171" href="#L171">171</a>                 1.222414585e-01, 1.099464743e-01});
-<a class="jxr_linenumber" name="L172" href="#L172">172</a>         checkDensity(0.1, 2.0,
-<a class="jxr_linenumber" name="L173" href="#L173">173</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L174" href="#L174">174</a>                 2.763072312e+04, 7.863770012e-01, 3.745874120e-01, 2.275514842e-01,
-<a class="jxr_linenumber" name="L175" href="#L175">175</a>                 1.505525939e-01, 1.026332391e-01, 6.968107049e-02, 4.549081293e-02,
-<a class="jxr_linenumber" name="L176" href="#L176">176</a>                 2.689298641e-02, 1.209399123e-02});
-<a class="jxr_linenumber" name="L177" href="#L177">177</a>         checkDensity(0.1, 4.0,
-<a class="jxr_linenumber" name="L178" href="#L178">178</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L179" href="#L179">179</a>                 2.997927462e+04, 6.911058917e-01, 2.601128486e-01, 1.209774010e-01,
-<a class="jxr_linenumber" name="L180" href="#L180">180</a>                 5.880564714e-02, 2.783915474e-02, 1.209657335e-02, 4.442148268e-03,
-<a class="jxr_linenumber" name="L181" href="#L181">181</a>                 1.167143939e-03, 1.312171805e-04});
-<a class="jxr_linenumber" name="L182" href="#L182">182</a>         checkDensity(0.5, 0.1,
-<a class="jxr_linenumber" name="L183" href="#L183">183</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L184" href="#L184">184</a>                 88.3152184726, 0.3070542841, 0.2414007269, 0.2222727015,
-<a class="jxr_linenumber" name="L185" href="#L185">185</a>                 0.2211409364, 0.2330652355, 0.2600795198, 0.3119449793,
-<a class="jxr_linenumber" name="L186" href="#L186">186</a>                 0.4203052841, 0.7394649088});
-<a class="jxr_linenumber" name="L187" href="#L187">187</a>         checkDensity(0.5, 0.5,
-<a class="jxr_linenumber" name="L188" href="#L188">188</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L189" href="#L189">189</a>                 318.3100453389, 1.0610282383, 0.7957732234, 0.6946084565,
-<a class="jxr_linenumber" name="L190" href="#L190">190</a>                 0.6497470636, 0.6366197724, 0.6497476051, 0.6946097796,
-<a class="jxr_linenumber" name="L191" href="#L191">191</a>                 0.7957762075, 1.0610376697});
-<a class="jxr_linenumber" name="L192" href="#L192">192</a>         checkDensity(0.5, 1.0,
-<a class="jxr_linenumber" name="L193" href="#L193">193</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L194" href="#L194">194</a>                 500.0000000000, 1.5811309244, 1.1180311937, 0.9128694077,
-<a class="jxr_linenumber" name="L195" href="#L195">195</a>                 0.7905684268, 0.7071060741, 0.6454966865, 0.5976138778,
-<a class="jxr_linenumber" name="L196" href="#L196">196</a>                 0.5590166450, 0.5270459839});
-<a class="jxr_linenumber" name="L197" href="#L197">197</a>         checkDensity(0.5, 2.0,
-<a class="jxr_linenumber" name="L198" href="#L198">198</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L199" href="#L199">199</a>                 749.99925000000, 2.134537420613655, 1.34163575536, 0.95851150881,
-<a class="jxr_linenumber" name="L200" href="#L200">200</a>                 0.71151039830, 0.53032849490, 0.38729704363, 0.26892534859,
-<a class="jxr_linenumber" name="L201" href="#L201">201</a>                 0.16770415497, 0.07905610701});
-<a class="jxr_linenumber" name="L202" href="#L202">202</a>         checkDensity(0.5, 4.0,
-<a class="jxr_linenumber" name="L203" href="#L203">203</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L204" href="#L204">204</a>                 1.093746719e+03, 2.52142232809988, 1.252190241e+00, 6.849343920e-01,
-<a class="jxr_linenumber" name="L205" href="#L205">205</a>                 3.735417140e-01, 1.933481570e-01, 9.036885833e-02, 3.529621669e-02,
-<a class="jxr_linenumber" name="L206" href="#L206">206</a>                 9.782644546e-03, 1.152878503e-03});
-<a class="jxr_linenumber" name="L207" href="#L207">207</a>         checkDensity(1.0, 0.1,
-<a class="jxr_linenumber" name="L208" href="#L208">208</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L209" href="#L209">209</a>                 0.1000000900, 0.1099466942, 0.1222417336, 0.1378517623, 0.1583669403,
-<a class="jxr_linenumber" name="L210" href="#L210">210</a>                 0.1866069342, 0.2281113974, 0.2955236034, 0.4256718768,
-<a class="jxr_linenumber" name="L211" href="#L211">211</a>                 0.7943353837});
-<a class="jxr_linenumber" name="L212" href="#L212">212</a>         checkDensity(1.0, 0.5,
-<a class="jxr_linenumber" name="L213" href="#L213">213</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L214" href="#L214">214</a>                 0.5000002500, 0.5270465695, 0.5590173438, 0.5976147315, 0.6454977623,
-<a class="jxr_linenumber" name="L215" href="#L215">215</a>                 0.7071074883, 0.7905704033, 0.9128724506,
-<a class="jxr_linenumber" name="L216" href="#L216">216</a>                 1.1180367838, 1.5811467358});
-<a class="jxr_linenumber" name="L217" href="#L217">217</a>         checkDensity(1, 1,
-<a class="jxr_linenumber" name="L218" href="#L218">218</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L219" href="#L219">219</a>                 1, 1, 1,
-<a class="jxr_linenumber" name="L220" href="#L220">220</a>                 1, 1, 1, 1,
-<a class="jxr_linenumber" name="L221" href="#L221">221</a>                 1, 1, 1});
-<a class="jxr_linenumber" name="L222" href="#L222">222</a>         checkDensity(1, 2,
-<a class="jxr_linenumber" name="L223" href="#L223">223</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L224" href="#L224">224</a>                 1.999998, 1.799998, 1.599998, 1.399998, 1.199998, 0.999998, 0.799998,
-<a class="jxr_linenumber" name="L225" href="#L225">225</a>                 0.599998, 0.399998,
-<a class="jxr_linenumber" name="L226" href="#L226">226</a>                 0.199998});
-<a class="jxr_linenumber" name="L227" href="#L227">227</a>         checkDensity(1, 4,
-<a class="jxr_linenumber" name="L228" href="#L228">228</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L229" href="#L229">229</a>                 3.999988000012, 2.915990280011, 2.047992320010, 1.371994120008,
-<a class="jxr_linenumber" name="L230" href="#L230">230</a>                 0.863995680007, 0.499997000006, 0.255998080005, 0.107998920004,
-<a class="jxr_linenumber" name="L231" href="#L231">231</a>                 0.031999520002, 0.003999880001});
-<a class="jxr_linenumber" name="L232" href="#L232">232</a>         checkDensity(2.0, 0.1,
-<a class="jxr_linenumber" name="L233" href="#L233">233</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L234" href="#L234">234</a>                 1.100000990e-07, 1.209425730e-02, 2.689331586e-02, 4.549123318e-02,
-<a class="jxr_linenumber" name="L235" href="#L235">235</a>                 6.968162794e-02, 1.026340191e-01, 1.505537732e-01, 2.275534997e-01,
-<a class="jxr_linenumber" name="L236" href="#L236">236</a>                 3.745917198e-01, 7.863929037e-01});
-<a class="jxr_linenumber" name="L237" href="#L237">237</a>         checkDensity(2.0, 0.5,
-<a class="jxr_linenumber" name="L238" href="#L238">238</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L239" href="#L239">239</a>                 7.500003750e-07, 7.905777599e-02, 1.677060417e-01, 2.689275256e-01,
-<a class="jxr_linenumber" name="L240" href="#L240">240</a>                 3.872996256e-01, 5.303316769e-01, 7.115145488e-01, 9.585174425e-01,
-<a class="jxr_linenumber" name="L241" href="#L241">241</a>                 1.341645818e+00, 2.134537420613655});
-<a class="jxr_linenumber" name="L242" href="#L242">242</a>         checkDensity(2, 1,
-<a class="jxr_linenumber" name="L243" href="#L243">243</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L244" href="#L244">244</a>                 0.000002, 0.200002, 0.400002, 0.600002, 0.800002, 1.000002, 1.200002,
-<a class="jxr_linenumber" name="L245" href="#L245">245</a>                 1.400002, 1.600002,
-<a class="jxr_linenumber" name="L246" href="#L246">246</a>                 1.800002});
-<a class="jxr_linenumber" name="L247" href="#L247">247</a>         checkDensity(2, 2,
-<a class="jxr_linenumber" name="L248" href="#L248">248</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L249" href="#L249">249</a>                 5.9999940e-06, 5.4000480e-01, 9.6000360e-01, 1.2600024e+00,
-<a class="jxr_linenumber" name="L250" href="#L250">250</a>                 1.4400012e+00, 1.5000000e+00, 1.4399988e+00, 1.2599976e+00,
-<a class="jxr_linenumber" name="L251" href="#L251">251</a>                 9.5999640e-01, 5.3999520e-01});
-<a class="jxr_linenumber" name="L252" href="#L252">252</a>         checkDensity(2, 4,
-<a class="jxr_linenumber" name="L253" href="#L253">253</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L254" href="#L254">254</a>                 0.00001999994, 1.45800971996, 2.04800255997, 2.05799803998,
-<a class="jxr_linenumber" name="L255" href="#L255">255</a>                 1.72799567999, 1.24999500000, 0.76799552000, 0.37799676001,
-<a class="jxr_linenumber" name="L256" href="#L256">256</a>                 0.12799824001, 0.01799948000});
-<a class="jxr_linenumber" name="L257" href="#L257">257</a>         checkDensity(4.0, 0.1,
-<a class="jxr_linenumber" name="L258" href="#L258">258</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L259" href="#L259">259</a>                 1.193501074e-19, 1.312253162e-04, 1.167181580e-03, 4.442248535e-03,
-<a class="jxr_linenumber" name="L260" href="#L260">260</a>                 1.209679109e-02, 2.783958903e-02, 5.880649983e-02, 1.209791638e-01,
-<a class="jxr_linenumber" name="L261" href="#L261">261</a>                 2.601171405e-01, 6.911229392e-01});
-<a class="jxr_linenumber" name="L262" href="#L262">262</a>         checkDensity(4.0, 0.5,
-<a class="jxr_linenumber" name="L263" href="#L263">263</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L264" href="#L264">264</a>                 1.093750547e-18, 1.152948959e-03, 9.782950259e-03, 3.529697305e-02,
-<a class="jxr_linenumber" name="L265" href="#L265">265</a>                 9.037036449e-02, 1.933508639e-01, 3.735463833e-01, 6.849425461e-01,
-<a class="jxr_linenumber" name="L266" href="#L266">266</a>                 1.252205894e+00, 2.52142232809988});
-<a class="jxr_linenumber" name="L267" href="#L267">267</a>         checkDensity(4, 1,
-<a class="jxr_linenumber" name="L268" href="#L268">268</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L269" href="#L269">269</a>                 4.000000000e-18, 4.000120001e-03, 3.200048000e-02, 1.080010800e-01,
-<a class="jxr_linenumber" name="L270" href="#L270">270</a>                 2.560019200e-01, 5.000030000e-01, 8.640043200e-01, 1.372005880e+00,
-<a class="jxr_linenumber" name="L271" href="#L271">271</a>                 2.048007680e+00, 2.916009720e+00});
-<a class="jxr_linenumber" name="L272" href="#L272">272</a>         checkDensity(4, 2,
-<a class="jxr_linenumber" name="L273" href="#L273">273</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L274" href="#L274">274</a>                 1.999998000e-17, 1.800052000e-02, 1.280017600e-01, 3.780032400e-01,
-<a class="jxr_linenumber" name="L275" href="#L275">275</a>                 7.680044800e-01, 1.250005000e+00, 1.728004320e+00, 2.058001960e+00,
-<a class="jxr_linenumber" name="L276" href="#L276">276</a>                 2.047997440e+00, 1.457990280e+00});
-<a class="jxr_linenumber" name="L277" href="#L277">277</a>         checkDensity(4, 4,
-<a class="jxr_linenumber" name="L278" href="#L278">278</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
-<a class="jxr_linenumber" name="L279" href="#L279">279</a>                 1.399995800e-16, 1.020627216e-01, 5.734464512e-01, 1.296547409e+00,
-<a class="jxr_linenumber" name="L280" href="#L280">280</a>                 1.935364838e+00, 2.187500000e+00, 1.935355162e+00, 1.296532591e+00,
-<a class="jxr_linenumber" name="L281" href="#L281">281</a>                 5.734335488e-01, 1.020572784e-01});
-<a class="jxr_linenumber" name="L282" href="#L282">282</a> 
-<a class="jxr_linenumber" name="L283" href="#L283">283</a>     }
-<a class="jxr_linenumber" name="L284" href="#L284">284</a> 
-<a class="jxr_linenumber" name="L285" href="#L285">285</a>     @SuppressWarnings(<span class="jxr_string">"boxing"</span>)
-<a class="jxr_linenumber" name="L286" href="#L286">286</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkDensity(<strong class="jxr_keyword">double</strong> alpha, <strong class="jxr_keyword">double</strong> beta, <strong class="jxr_keyword">double</strong>[] x, <strong class="jxr_keyword">double</strong>[] expected) {
-<a class="jxr_linenumber" name="L287" href="#L287">287</a>         BetaDistribution d = <strong class="jxr_keyword">new</strong> BetaDistribution(alpha, beta);
-<a class="jxr_linenumber" name="L288" href="#L288">288</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; x.length; i++) {
-<a class="jxr_linenumber" name="L289" href="#L289">289</a>             Assert.assertEquals(String.format(<span class="jxr_string">"density at x=%.1f for alpha=%.1f, beta=%.1f"</span>, x[i], alpha, beta), expected[i], d.density(x[i]), 1e-5);
-<a class="jxr_linenumber" name="L290" href="#L290">290</a>         }
-<a class="jxr_linenumber" name="L291" href="#L291">291</a>     }
-<a class="jxr_linenumber" name="L292" href="#L292">292</a> 
-<a class="jxr_linenumber" name="L293" href="#L293">293</a>     @Test
-<a class="jxr_linenumber" name="L294" href="#L294">294</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testMoments() {
-<a class="jxr_linenumber" name="L295" href="#L295">295</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> tol = 1e-9;
-<a class="jxr_linenumber" name="L296" href="#L296">296</a>         BetaDistribution dist;
-<a class="jxr_linenumber" name="L297" href="#L297">297</a> 
-<a class="jxr_linenumber" name="L298" href="#L298">298</a>         dist = <strong class="jxr_keyword">new</strong> BetaDistribution(1, 1);
-<a class="jxr_linenumber" name="L299" href="#L299">299</a>         Assert.assertEquals(dist.getNumericalMean(), 0.5, tol);
-<a class="jxr_linenumber" name="L300" href="#L300">300</a>         Assert.assertEquals(dist.getNumericalVariance(), 1.0 / 12.0, tol);
-<a class="jxr_linenumber" name="L301" href="#L301">301</a> 
-<a class="jxr_linenumber" name="L302" href="#L302">302</a>         dist = <strong class="jxr_keyword">new</strong> BetaDistribution(2, 5);
-<a class="jxr_linenumber" name="L303" href="#L303">303</a>         Assert.assertEquals(dist.getNumericalMean(), 2.0 / 7.0, tol);
-<a class="jxr_linenumber" name="L304" href="#L304">304</a>         Assert.assertEquals(dist.getNumericalVariance(), 10.0 / (49.0 * 8.0), tol);
-<a class="jxr_linenumber" name="L305" href="#L305">305</a>     }
-<a class="jxr_linenumber" name="L306" href="#L306">306</a> }
+<a class="jxr_linenumber" name="L125" href="#L125">125</a>                 0.000, 0.000, 0.028, 0.104, 0.216, 0.352, 0.500, 0.648, 0.784, 0.896, 0.972, 1.000, 1.000});
+<a class="jxr_linenumber" name="L126" href="#L126">126</a>         checkCumulative(2, 4,
+<a class="jxr_linenumber" name="L127" href="#L127">127</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L128" href="#L128">128</a>                 0.00000, 0.00000, 0.08146, 0.26272, 0.47178, 0.66304, 0.81250, 0.91296,
+<a class="jxr_linenumber" name="L129" href="#L129">129</a>                 0.96922, 0.99328, 0.99954, 1.00000, 1.00000});
+<a class="jxr_linenumber" name="L130" href="#L130">130</a>         checkCumulative(4.0, 0.1,
+<a class="jxr_linenumber" name="L131" href="#L131">131</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L132" href="#L132">132</a>                 0.000000000e+00, 0.000000000e+00, 3.217128269e-06, 5.592070271e-05,
+<a class="jxr_linenumber" name="L133" href="#L133">133</a>                 3.104375474e-04, 1.088719595e-03, 2.995933981e-03, 7.155588777e-03,
+<a class="jxr_linenumber" name="L134" href="#L134">134</a>                 1.577149153e-02, 3.380410585e-02, 7.650088789e-02, 1.000000000e+00, 1.000000000e+00});
+<a class="jxr_linenumber" name="L135" href="#L135">135</a>         checkCumulative(4.0, 0.5,
+<a class="jxr_linenumber" name="L136" href="#L136">136</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L137" href="#L137">137</a>                 0.000000000e+00, 0.000000000e+00, 2.851114863e-05, 4.776140576e-04,
+<a class="jxr_linenumber" name="L138" href="#L138">138</a>                 2.544374616e-03, 8.516263371e-03, 2.220390414e-02, 4.973556312e-02,
+<a class="jxr_linenumber" name="L139" href="#L139">139</a>                 1.012215158e-01, 1.950155281e-01, 3.733749174e-01, 1.000000000e+00, 1.000000000e+00});
+<a class="jxr_linenumber" name="L140" href="#L140">140</a>         checkCumulative(4, 1,
+<a class="jxr_linenumber" name="L141" href="#L141">141</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L142" href="#L142">142</a>                 0.0000, 0.0000, 0.0001, 0.0016, 0.0081, 0.0256, 0.0625, 0.1296, 0.2401,
+<a class="jxr_linenumber" name="L143" href="#L143">143</a>                 0.4096, 0.6561, 1.0000, 1.0000});
+<a class="jxr_linenumber" name="L144" href="#L144">144</a>         checkCumulative(4, 2,
+<a class="jxr_linenumber" name="L145" href="#L145">145</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L146" href="#L146">146</a>                 0.00000, 0.00000, 0.00046, 0.00672, 0.03078, 0.08704, 0.18750, 0.33696,
+<a class="jxr_linenumber" name="L147" href="#L147">147</a>                 0.52822, 0.73728, 0.91854, 1.00000, 1.00000});
+<a class="jxr_linenumber" name="L148" href="#L148">148</a>         checkCumulative(4, 4,
+<a class="jxr_linenumber" name="L149" href="#L149">149</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L150" href="#L150">150</a>                 0.000000, 0.000000, 0.002728, 0.033344, 0.126036, 0.289792, 0.500000,
+<a class="jxr_linenumber" name="L151" href="#L151">151</a>                 0.710208, 0.873964, 0.966656, 0.997272, 1.000000, 1.000000});
+<a class="jxr_linenumber" name="L152" href="#L152">152</a> 
+<a class="jxr_linenumber" name="L153" href="#L153">153</a>     }
+<a class="jxr_linenumber" name="L154" href="#L154">154</a> 
+<a class="jxr_linenumber" name="L155" href="#L155">155</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkCumulative(<strong class="jxr_keyword">double</strong> alpha, <strong class="jxr_keyword">double</strong> beta, <strong class="jxr_keyword">double</strong>[] x, <strong class="jxr_keyword">double</strong>[] cumes) {
+<a class="jxr_linenumber" name="L156" href="#L156">156</a>         BetaDistribution d = <strong class="jxr_keyword">new</strong> BetaDistribution(alpha, beta);
+<a class="jxr_linenumber" name="L157" href="#L157">157</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; x.length; i++) {
+<a class="jxr_linenumber" name="L158" href="#L158">158</a>             Assert.assertEquals(cumes[i], d.cumulativeProbability(x[i]), 1e-8);
+<a class="jxr_linenumber" name="L159" href="#L159">159</a>         }
+<a class="jxr_linenumber" name="L160" href="#L160">160</a> 
+<a class="jxr_linenumber" name="L161" href="#L161">161</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 1; i &lt; x.length - 1; i++) {
+<a class="jxr_linenumber" name="L162" href="#L162">162</a>             Assert.assertEquals(x[i], d.inverseCumulativeProbability(cumes[i]), 1e-5);
+<a class="jxr_linenumber" name="L163" href="#L163">163</a>         }
+<a class="jxr_linenumber" name="L164" href="#L164">164</a>     }
+<a class="jxr_linenumber" name="L165" href="#L165">165</a> 
+<a class="jxr_linenumber" name="L166" href="#L166">166</a>     @Test
+<a class="jxr_linenumber" name="L167" href="#L167">167</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDensity() {
+<a class="jxr_linenumber" name="L168" href="#L168">168</a>         <strong class="jxr_keyword">double</strong>[] x = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{1e-6, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9};
+<a class="jxr_linenumber" name="L169" href="#L169">169</a>         checkDensity(0.1, 0.1,
+<a class="jxr_linenumber" name="L170" href="#L170">170</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L171" href="#L171">171</a>                 12741.2357380649, 0.4429889586665234, 2.639378715e-01, 2.066393611e-01,
+<a class="jxr_linenumber" name="L172" href="#L172">172</a>                 1.832401831e-01, 1.766302780e-01, 1.832404579e-01, 2.066400696e-01,
+<a class="jxr_linenumber" name="L173" href="#L173">173</a>                 2.639396531e-01, 4.429925026e-01});
+<a class="jxr_linenumber" name="L174" href="#L174">174</a>         checkDensity(0.1, 0.5,
+<a class="jxr_linenumber" name="L175" href="#L175">175</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L176" href="#L176">176</a>                 2.218377102e+04, 7.394524202e-01, 4.203020268e-01, 3.119435533e-01,
+<a class="jxr_linenumber" name="L177" href="#L177">177</a>                 2.600787829e-01, 2.330648626e-01, 2.211408259e-01, 2.222728708e-01,
+<a class="jxr_linenumber" name="L178" href="#L178">178</a>                 2.414013907e-01, 3.070567405e-01});
+<a class="jxr_linenumber" name="L179" href="#L179">179</a>         checkDensity(0.1, 1.0,
+<a class="jxr_linenumber" name="L180" href="#L180">180</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L181" href="#L181">181</a>                 2.511886432e+04, 7.943210858e-01, 4.256680458e-01, 2.955218303e-01,
+<a class="jxr_linenumber" name="L182" href="#L182">182</a>                 2.281103709e-01, 1.866062624e-01, 1.583664652e-01, 1.378514078e-01,
+<a class="jxr_linenumber" name="L183" href="#L183">183</a>                 1.222414585e-01, 1.099464743e-01});
+<a class="jxr_linenumber" name="L184" href="#L184">184</a>         checkDensity(0.1, 2.0,
+<a class="jxr_linenumber" name="L185" href="#L185">185</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L186" href="#L186">186</a>                 2.763072312e+04, 7.863770012e-01, 3.745874120e-01, 2.275514842e-01,
+<a class="jxr_linenumber" name="L187" href="#L187">187</a>                 1.505525939e-01, 1.026332391e-01, 6.968107049e-02, 4.549081293e-02,
+<a class="jxr_linenumber" name="L188" href="#L188">188</a>                 2.689298641e-02, 1.209399123e-02});
+<a class="jxr_linenumber" name="L189" href="#L189">189</a>         checkDensity(0.1, 4.0,
+<a class="jxr_linenumber" name="L190" href="#L190">190</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L191" href="#L191">191</a>                 2.997927462e+04, 6.911058917e-01, 2.601128486e-01, 1.209774010e-01,
+<a class="jxr_linenumber" name="L192" href="#L192">192</a>                 5.880564714e-02, 2.783915474e-02, 1.209657335e-02, 4.442148268e-03,
+<a class="jxr_linenumber" name="L193" href="#L193">193</a>                 1.167143939e-03, 1.312171805e-04});
+<a class="jxr_linenumber" name="L194" href="#L194">194</a>         checkDensity(0.5, 0.1,
+<a class="jxr_linenumber" name="L195" href="#L195">195</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L196" href="#L196">196</a>                 88.3152184726, 0.3070542841, 0.2414007269, 0.2222727015,
+<a class="jxr_linenumber" name="L197" href="#L197">197</a>                 0.2211409364, 0.2330652355, 0.2600795198, 0.3119449793,
+<a class="jxr_linenumber" name="L198" href="#L198">198</a>                 0.4203052841, 0.7394649088});
+<a class="jxr_linenumber" name="L199" href="#L199">199</a>         checkDensity(0.5, 0.5,
+<a class="jxr_linenumber" name="L200" href="#L200">200</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L201" href="#L201">201</a>                 318.3100453389, 1.0610282383, 0.7957732234, 0.6946084565,
+<a class="jxr_linenumber" name="L202" href="#L202">202</a>                 0.6497470636, 0.6366197724, 0.6497476051, 0.6946097796,
+<a class="jxr_linenumber" name="L203" href="#L203">203</a>                 0.7957762075, 1.0610376697});
+<a class="jxr_linenumber" name="L204" href="#L204">204</a>         checkDensity(0.5, 1.0,
+<a class="jxr_linenumber" name="L205" href="#L205">205</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L206" href="#L206">206</a>                 500.0000000000, 1.5811309244, 1.1180311937, 0.9128694077,
+<a class="jxr_linenumber" name="L207" href="#L207">207</a>                 0.7905684268, 0.7071060741, 0.6454966865, 0.5976138778,
+<a class="jxr_linenumber" name="L208" href="#L208">208</a>                 0.5590166450, 0.5270459839});
+<a class="jxr_linenumber" name="L209" href="#L209">209</a>         checkDensity(0.5, 2.0,
+<a class="jxr_linenumber" name="L210" href="#L210">210</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L211" href="#L211">211</a>                 749.99925000000, 2.134537420613655, 1.34163575536, 0.95851150881,
+<a class="jxr_linenumber" name="L212" href="#L212">212</a>                 0.71151039830, 0.53032849490, 0.38729704363, 0.26892534859,
+<a class="jxr_linenumber" name="L213" href="#L213">213</a>                 0.16770415497, 0.07905610701});
+<a class="jxr_linenumber" name="L214" href="#L214">214</a>         checkDensity(0.5, 4.0,
+<a class="jxr_linenumber" name="L215" href="#L215">215</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L216" href="#L216">216</a>                 1.093746719e+03, 2.52142232809988, 1.252190241e+00, 6.849343920e-01,
+<a class="jxr_linenumber" name="L217" href="#L217">217</a>                 3.735417140e-01, 1.933481570e-01, 9.036885833e-02, 3.529621669e-02,
+<a class="jxr_linenumber" name="L218" href="#L218">218</a>                 9.782644546e-03, 1.152878503e-03});
+<a class="jxr_linenumber" name="L219" href="#L219">219</a>         checkDensity(1.0, 0.1,
+<a class="jxr_linenumber" name="L220" href="#L220">220</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L221" href="#L221">221</a>                 0.1000000900, 0.1099466942, 0.1222417336, 0.1378517623, 0.1583669403,
+<a class="jxr_linenumber" name="L222" href="#L222">222</a>                 0.1866069342, 0.2281113974, 0.2955236034, 0.4256718768,
+<a class="jxr_linenumber" name="L223" href="#L223">223</a>                 0.7943353837});
+<a class="jxr_linenumber" name="L224" href="#L224">224</a>         checkDensity(1.0, 0.5,
+<a class="jxr_linenumber" name="L225" href="#L225">225</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L226" href="#L226">226</a>                 0.5000002500, 0.5270465695, 0.5590173438, 0.5976147315, 0.6454977623,
+<a class="jxr_linenumber" name="L227" href="#L227">227</a>                 0.7071074883, 0.7905704033, 0.9128724506,
+<a class="jxr_linenumber" name="L228" href="#L228">228</a>                 1.1180367838, 1.5811467358});
+<a class="jxr_linenumber" name="L229" href="#L229">229</a>         checkDensity(1, 1,
+<a class="jxr_linenumber" name="L230" href="#L230">230</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L231" href="#L231">231</a>                 1, 1, 1,
+<a class="jxr_linenumber" name="L232" href="#L232">232</a>                 1, 1, 1, 1,
+<a class="jxr_linenumber" name="L233" href="#L233">233</a>                 1, 1, 1});
+<a class="jxr_linenumber" name="L234" href="#L234">234</a>         checkDensity(1, 2,
+<a class="jxr_linenumber" name="L235" href="#L235">235</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L236" href="#L236">236</a>                 1.999998, 1.799998, 1.599998, 1.399998, 1.199998, 0.999998, 0.799998,
+<a class="jxr_linenumber" name="L237" href="#L237">237</a>                 0.599998, 0.399998,
+<a class="jxr_linenumber" name="L238" href="#L238">238</a>                 0.199998});
+<a class="jxr_linenumber" name="L239" href="#L239">239</a>         checkDensity(1, 4,
+<a class="jxr_linenumber" name="L240" href="#L240">240</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L241" href="#L241">241</a>                 3.999988000012, 2.915990280011, 2.047992320010, 1.371994120008,
+<a class="jxr_linenumber" name="L242" href="#L242">242</a>                 0.863995680007, 0.499997000006, 0.255998080005, 0.107998920004,
+<a class="jxr_linenumber" name="L243" href="#L243">243</a>                 0.031999520002, 0.003999880001});
+<a class="jxr_linenumber" name="L244" href="#L244">244</a>         checkDensity(2.0, 0.1,
+<a class="jxr_linenumber" name="L245" href="#L245">245</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L246" href="#L246">246</a>                 1.100000990e-07, 1.209425730e-02, 2.689331586e-02, 4.549123318e-02,
+<a class="jxr_linenumber" name="L247" href="#L247">247</a>                 6.968162794e-02, 1.026340191e-01, 1.505537732e-01, 2.275534997e-01,
+<a class="jxr_linenumber" name="L248" href="#L248">248</a>                 3.745917198e-01, 7.863929037e-01});
+<a class="jxr_linenumber" name="L249" href="#L249">249</a>         checkDensity(2.0, 0.5,
+<a class="jxr_linenumber" name="L250" href="#L250">250</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L251" href="#L251">251</a>                 7.500003750e-07, 7.905777599e-02, 1.677060417e-01, 2.689275256e-01,
+<a class="jxr_linenumber" name="L252" href="#L252">252</a>                 3.872996256e-01, 5.303316769e-01, 7.115145488e-01, 9.585174425e-01,
+<a class="jxr_linenumber" name="L253" href="#L253">253</a>                 1.341645818e+00, 2.134537420613655});
+<a class="jxr_linenumber" name="L254" href="#L254">254</a>         checkDensity(2, 1,
+<a class="jxr_linenumber" name="L255" href="#L255">255</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L256" href="#L256">256</a>                 0.000002, 0.200002, 0.400002, 0.600002, 0.800002, 1.000002, 1.200002,
+<a class="jxr_linenumber" name="L257" href="#L257">257</a>                 1.400002, 1.600002,
+<a class="jxr_linenumber" name="L258" href="#L258">258</a>                 1.800002});
+<a class="jxr_linenumber" name="L259" href="#L259">259</a>         checkDensity(2, 2,
+<a class="jxr_linenumber" name="L260" href="#L260">260</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L261" href="#L261">261</a>                 5.9999940e-06, 5.4000480e-01, 9.6000360e-01, 1.2600024e+00,
+<a class="jxr_linenumber" name="L262" href="#L262">262</a>                 1.4400012e+00, 1.5000000e+00, 1.4399988e+00, 1.2599976e+00,
+<a class="jxr_linenumber" name="L263" href="#L263">263</a>                 9.5999640e-01, 5.3999520e-01});
+<a class="jxr_linenumber" name="L264" href="#L264">264</a>         checkDensity(2, 4,
+<a class="jxr_linenumber" name="L265" href="#L265">265</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L266" href="#L266">266</a>                 0.00001999994, 1.45800971996, 2.04800255997, 2.05799803998,
+<a class="jxr_linenumber" name="L267" href="#L267">267</a>                 1.72799567999, 1.24999500000, 0.76799552000, 0.37799676001,
+<a class="jxr_linenumber" name="L268" href="#L268">268</a>                 0.12799824001, 0.01799948000});
+<a class="jxr_linenumber" name="L269" href="#L269">269</a>         checkDensity(4.0, 0.1,
+<a class="jxr_linenumber" name="L270" href="#L270">270</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L271" href="#L271">271</a>                 1.193501074e-19, 1.312253162e-04, 1.167181580e-03, 4.442248535e-03,
+<a class="jxr_linenumber" name="L272" href="#L272">272</a>                 1.209679109e-02, 2.783958903e-02, 5.880649983e-02, 1.209791638e-01,
+<a class="jxr_linenumber" name="L273" href="#L273">273</a>                 2.601171405e-01, 6.911229392e-01});
+<a class="jxr_linenumber" name="L274" href="#L274">274</a>         checkDensity(4.0, 0.5,
+<a class="jxr_linenumber" name="L275" href="#L275">275</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L276" href="#L276">276</a>                 1.093750547e-18, 1.152948959e-03, 9.782950259e-03, 3.529697305e-02,
+<a class="jxr_linenumber" name="L277" href="#L277">277</a>                 9.037036449e-02, 1.933508639e-01, 3.735463833e-01, 6.849425461e-01,
+<a class="jxr_linenumber" name="L278" href="#L278">278</a>                 1.252205894e+00, 2.52142232809988});
+<a class="jxr_linenumber" name="L279" href="#L279">279</a>         checkDensity(4, 1,
+<a class="jxr_linenumber" name="L280" href="#L280">280</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L281" href="#L281">281</a>                 4.000000000e-18, 4.000120001e-03, 3.200048000e-02, 1.080010800e-01,
+<a class="jxr_linenumber" name="L282" href="#L282">282</a>                 2.560019200e-01, 5.000030000e-01, 8.640043200e-01, 1.372005880e+00,
+<a class="jxr_linenumber" name="L283" href="#L283">283</a>                 2.048007680e+00, 2.916009720e+00});
+<a class="jxr_linenumber" name="L284" href="#L284">284</a>         checkDensity(4, 2,
+<a class="jxr_linenumber" name="L285" href="#L285">285</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L286" href="#L286">286</a>                 1.999998000e-17, 1.800052000e-02, 1.280017600e-01, 3.780032400e-01,
+<a class="jxr_linenumber" name="L287" href="#L287">287</a>                 7.680044800e-01, 1.250005000e+00, 1.728004320e+00, 2.058001960e+00,
+<a class="jxr_linenumber" name="L288" href="#L288">288</a>                 2.047997440e+00, 1.457990280e+00});
+<a class="jxr_linenumber" name="L289" href="#L289">289</a>         checkDensity(4, 4,
+<a class="jxr_linenumber" name="L290" href="#L290">290</a>                 x, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[]{
+<a class="jxr_linenumber" name="L291" href="#L291">291</a>                 1.399995800e-16, 1.020627216e-01, 5.734464512e-01, 1.296547409e+00,
+<a class="jxr_linenumber" name="L292" href="#L292">292</a>                 1.935364838e+00, 2.187500000e+00, 1.935355162e+00, 1.296532591e+00,
+<a class="jxr_linenumber" name="L293" href="#L293">293</a>                 5.734335488e-01, 1.020572784e-01});
+<a class="jxr_linenumber" name="L294" href="#L294">294</a> 
+<a class="jxr_linenumber" name="L295" href="#L295">295</a>     }
+<a class="jxr_linenumber" name="L296" href="#L296">296</a> 
+<a class="jxr_linenumber" name="L297" href="#L297">297</a>     @SuppressWarnings(<span class="jxr_string">"boxing"</span>)
+<a class="jxr_linenumber" name="L298" href="#L298">298</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkDensity(<strong class="jxr_keyword">double</strong> alpha, <strong class="jxr_keyword">double</strong> beta, <strong class="jxr_keyword">double</strong>[] x, <strong class="jxr_keyword">double</strong>[] expected) {
+<a class="jxr_linenumber" name="L299" href="#L299">299</a>         BetaDistribution d = <strong class="jxr_keyword">new</strong> BetaDistribution(alpha, beta);
+<a class="jxr_linenumber" name="L300" href="#L300">300</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; x.length; i++) {
+<a class="jxr_linenumber" name="L301" href="#L301">301</a>             Assert.assertEquals(String.format(<span class="jxr_string">"density at x=%.1f for alpha=%.1f, beta=%.1f"</span>, x[i], alpha, beta), expected[i], d.density(x[i]), 1e-5);
+<a class="jxr_linenumber" name="L302" href="#L302">302</a>         }
+<a class="jxr_linenumber" name="L303" href="#L303">303</a>     }
+<a class="jxr_linenumber" name="L304" href="#L304">304</a> 
+<a class="jxr_linenumber" name="L305" href="#L305">305</a>     @Test
+<a class="jxr_linenumber" name="L306" href="#L306">306</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testMoments() {
+<a class="jxr_linenumber" name="L307" href="#L307">307</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> tol = 1e-9;
+<a class="jxr_linenumber" name="L308" href="#L308">308</a>         BetaDistribution dist;
+<a class="jxr_linenumber" name="L309" href="#L309">309</a> 
+<a class="jxr_linenumber" name="L310" href="#L310">310</a>         dist = <strong class="jxr_keyword">new</strong> BetaDistribution(1, 1);
+<a class="jxr_linenumber" name="L311" href="#L311">311</a>         Assert.assertEquals(dist.getNumericalMean(), 0.5, tol);
+<a class="jxr_linenumber" name="L312" href="#L312">312</a>         Assert.assertEquals(dist.getNumericalVariance(), 1.0 / 12.0, tol);
+<a class="jxr_linenumber" name="L313" href="#L313">313</a> 
+<a class="jxr_linenumber" name="L314" href="#L314">314</a>         dist = <strong class="jxr_keyword">new</strong> BetaDistribution(2, 5);
+<a class="jxr_linenumber" name="L315" href="#L315">315</a>         Assert.assertEquals(dist.getNumericalMean(), 2.0 / 7.0, tol);
+<a class="jxr_linenumber" name="L316" href="#L316">316</a>         Assert.assertEquals(dist.getNumericalVariance(), 10.0 / (49.0 * 8.0), tol);
+<a class="jxr_linenumber" name="L317" href="#L317">317</a>     }
+<a class="jxr_linenumber" name="L318" href="#L318">318</a> 
+<a class="jxr_linenumber" name="L319" href="#L319">319</a>     @Test
+<a class="jxr_linenumber" name="L320" href="#L320">320</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testMomentsSampling() {
+<a class="jxr_linenumber" name="L321" href="#L321">321</a>         RandomGenerator random = <strong class="jxr_keyword">new</strong> Well1024a(0x7829862c82fec2dal);
+<a class="jxr_linenumber" name="L322" href="#L322">322</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> numSamples = 1000;
+<a class="jxr_linenumber" name="L323" href="#L323">323</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> alpha : alphaBetas) {
+<a class="jxr_linenumber" name="L324" href="#L324">324</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> beta : alphaBetas) {
+<a class="jxr_linenumber" name="L325" href="#L325">325</a>                 <strong class="jxr_keyword">final</strong> BetaDistribution betaDistribution = <strong class="jxr_keyword">new</strong> BetaDistribution(random, alpha, beta);
+<a class="jxr_linenumber" name="L326" href="#L326">326</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] observed = <strong class="jxr_keyword">new</strong> BetaDistribution(alpha, beta).sample(numSamples);
+<a class="jxr_linenumber" name="L327" href="#L327">327</a>                 Arrays.sort(observed);
+<a class="jxr_linenumber" name="L328" href="#L328">328</a> 
+<a class="jxr_linenumber" name="L329" href="#L329">329</a>                 <strong class="jxr_keyword">final</strong> String distribution = String.format(<span class="jxr_string">"Beta(%.2f, %.2f)"</span>, alpha, beta);
+<a class="jxr_linenumber" name="L330" href="#L330">330</a>                 Assert.assertEquals(String.format(<span class="jxr_string">"E[%s]"</span>, distribution),
+<a class="jxr_linenumber" name="L331" href="#L331">331</a>                                     betaDistribution.getNumericalMean(),
+<a class="jxr_linenumber" name="L332" href="#L332">332</a>                                     StatUtils.mean(observed), epsilon);
+<a class="jxr_linenumber" name="L333" href="#L333">333</a>                 Assert.assertEquals(String.format(<span class="jxr_string">"Var[%s]"</span>, distribution),
+<a class="jxr_linenumber" name="L334" href="#L334">334</a>                                     betaDistribution.getNumericalVariance(),
+<a class="jxr_linenumber" name="L335" href="#L335">335</a>                                     StatUtils.variance(observed), epsilon);
+<a class="jxr_linenumber" name="L336" href="#L336">336</a>             }
+<a class="jxr_linenumber" name="L337" href="#L337">337</a>         }
+<a class="jxr_linenumber" name="L338" href="#L338">338</a>     }
+<a class="jxr_linenumber" name="L339" href="#L339">339</a> 
+<a class="jxr_linenumber" name="L340" href="#L340">340</a>     @Test
+<a class="jxr_linenumber" name="L341" href="#L341">341</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testGoodnessOfFit() {
+<a class="jxr_linenumber" name="L342" href="#L342">342</a>         RandomGenerator random = <strong class="jxr_keyword">new</strong> Well19937a(0x237db1db907b089fl);
+<a class="jxr_linenumber" name="L343" href="#L343">343</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> numSamples = 1000;
+<a class="jxr_linenumber" name="L344" href="#L344">344</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> level = 0.01;
+<a class="jxr_linenumber" name="L345" href="#L345">345</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> alpha : alphaBetas) {
+<a class="jxr_linenumber" name="L346" href="#L346">346</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> beta : alphaBetas) {
+<a class="jxr_linenumber" name="L347" href="#L347">347</a>                 <strong class="jxr_keyword">final</strong> BetaDistribution betaDistribution = <strong class="jxr_keyword">new</strong> BetaDistribution(random, alpha, beta);
+<a class="jxr_linenumber" name="L348" href="#L348">348</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] observed = betaDistribution.sample(numSamples);
+<a class="jxr_linenumber" name="L349" href="#L349">349</a>                 Assert.assertFalse(<span class="jxr_string">"G goodness-of-fit test rejected null at alpha = "</span> + level,
+<a class="jxr_linenumber" name="L350" href="#L350">350</a>                                    gTest(betaDistribution, observed) &lt; level);
+<a class="jxr_linenumber" name="L351" href="#L351">351</a>                 Assert.assertFalse(<span class="jxr_string">"KS goodness-of-fit test rejected null at alpha = "</span> + level,
+<a class="jxr_linenumber" name="L352" href="#L352">352</a>                                    <strong class="jxr_keyword">new</strong> KolmogorovSmirnovTest(random).kolmogorovSmirnovTest(betaDistribution, observed) &lt; level);
+<a class="jxr_linenumber" name="L353" href="#L353">353</a>             }
+<a class="jxr_linenumber" name="L354" href="#L354">354</a>         }
+<a class="jxr_linenumber" name="L355" href="#L355">355</a>     }
+<a class="jxr_linenumber" name="L356" href="#L356">356</a> 
+<a class="jxr_linenumber" name="L357" href="#L357">357</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">double</strong> gTest(<strong class="jxr_keyword">final</strong> RealDistribution expectedDistribution, <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] values) {
+<a class="jxr_linenumber" name="L358" href="#L358">358</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> numBins = values.length / 30;
+<a class="jxr_linenumber" name="L359" href="#L359">359</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] breaks = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[numBins];
+<a class="jxr_linenumber" name="L360" href="#L360">360</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> b = 0; b &lt; breaks.length; b++) {
+<a class="jxr_linenumber" name="L361" href="#L361">361</a>             breaks[b] = expectedDistribution.inverseCumulativeProbability((<strong class="jxr_keyword">double</strong>) b / numBins);
+<a class="jxr_linenumber" name="L362" href="#L362">362</a>         }
+<a class="jxr_linenumber" name="L363" href="#L363">363</a> 
+<a class="jxr_linenumber" name="L364" href="#L364">364</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong>[] observed = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">long</strong>[numBins];
+<a class="jxr_linenumber" name="L365" href="#L365">365</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> value : values) {
+<a class="jxr_linenumber" name="L366" href="#L366">366</a>             <strong class="jxr_keyword">int</strong> b = 0;
+<a class="jxr_linenumber" name="L367" href="#L367">367</a>             <strong class="jxr_keyword">do</strong> {
+<a class="jxr_linenumber" name="L368" href="#L368">368</a>                 b++;
+<a class="jxr_linenumber" name="L369" href="#L369">369</a>             } <strong class="jxr_keyword">while</strong> (b &lt; numBins &amp;&amp; value &gt;= breaks[b]);
+<a class="jxr_linenumber" name="L370" href="#L370">370</a> 
+<a class="jxr_linenumber" name="L371" href="#L371">371</a>             observed[b - 1]++;
+<a class="jxr_linenumber" name="L372" href="#L372">372</a>         }
+<a class="jxr_linenumber" name="L373" href="#L373">373</a> 
+<a class="jxr_linenumber" name="L374" href="#L374">374</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong>[] expected = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">double</strong>[numBins];
+<a class="jxr_linenumber" name="L375" href="#L375">375</a>         Arrays.fill(expected, (<strong class="jxr_keyword">double</strong>) values.length / numBins);
+<a class="jxr_linenumber" name="L376" href="#L376">376</a> 
+<a class="jxr_linenumber" name="L377" href="#L377">377</a>         <strong class="jxr_keyword">return</strong> TestUtils.gTest(expected, observed);
+<a class="jxr_linenumber" name="L378" href="#L378">378</a>     }
+<a class="jxr_linenumber" name="L379" href="#L379">379</a> }
 </pre>
 <hr/>
 <div id="footer">Copyright &#169; 2003&#x2013;2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</div>



Mime
View raw message