Skip to content

Commit

Permalink
Fix incorrect parentheses placement in chi^2 distribution. Still clos…
Browse files Browse the repository at this point in the history
…e, except for 1 DoF.
  • Loading branch information
BrentSeidel committed May 30, 2024
1 parent 30db574 commit 07231a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/BBS-Numerical-Statistics.adb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ package body BBS.Numerical.Statistics is
begin
if x > 0.0 then
return (elem."**"(x, (f'Base(k)/2.0)-1.0)*elem.Exp(-x/2.0))/
(elem."**"(2.0, (f'Base(k)/2.0)*funct.gamma2n(k)));
(elem."**"(2.0, (f'Base(k)/2.0))*funct.gamma2n(k));
else
return 0.0;
end if;
Expand Down
4 changes: 2 additions & 2 deletions test/test_stats.adb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ begin
Ada.Text_IO.Put(" ");
float_io.Put(stat.normal_cdf(0.0, val, 20), 1, 5, 0);
Ada.Text_IO.Put(" ");
float_io.Put(stat.chi2_pdf(val, 2), 1, 5, 0);
float_io.Put(stat.chi2_pdf(val, 1), 1, 5, 0);
Ada.Text_IO.Put(" ");
float_io.Put(stat.chi2_cdf(0.0, val, 2, 20), 1, 5, 0);
float_io.Put(stat.chi2_cdf(0.0, val, 1, 20), 1, 5, 0);
Ada.Text_IO.New_Line;
end loop;
end test_stats;

0 comments on commit 07231a7

Please sign in to comment.