diff --git a/applications/lazstats/source/LazStats.lpi b/applications/lazstats/source/LazStats.lpi
index 4918f8da7..7ee3cec0d 100644
--- a/applications/lazstats/source/LazStats.lpi
+++ b/applications/lazstats/source/LazStats.lpi
@@ -1441,8 +1441,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1452,11 +1464,6 @@
-
-
-
-
-
diff --git a/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas b/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas
index d2018d89f..6f57cd031 100644
--- a/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas
+++ b/applications/lazstats/source/forms/analysis/descriptive/frequnit.pas
@@ -6,7 +6,7 @@ unit FreqUnit;
interface
-uses
+uses lazlogger,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, LCLVersion,
StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin,
Globals, MainUnit, DataProcs,
@@ -108,7 +108,9 @@ var
m: Double;
e: Integer;
begin
- intervalSize := round((AMax - AMin) / NoIntervalsEdit.Value);
+// intervalSize := round((AMax - AMin) / NoIntervalsEdit.Value);
+ intervalSize := (AMax - AMin) / NoIntervalsEdit.Value;
+ if intervalSize = 0 then intervalSize := 1;
MantisseAndExponent(intervalSize, m, e);
m := round(m);
AIntervalSize := m * IntPower(10, e);
@@ -164,13 +166,6 @@ begin
exit;
end;
- SetLength(freq, NoCases);
- SetLength(pcnt, NoCases);
- SetLength(cumpcnt, NoCases);
- SetLength(pcntilerank, NoCases);
- SetLength(cumfreq, NoCases);
- SetLength(XValue, NoCases);
-
lReport := TStringList.Create;
try
lReport.Add('FREQUENCY ANALYSIS BY BILL MILLER');
@@ -208,8 +203,12 @@ begin
CalcIntervals(min, max, incrSize, nInts);
SetLength(freq, nInts);
+ SetLength(cumFreq, nInts);
SetLength(XValue, nInts);
SetLength(XLabels, nInts);
+ SetLength(pcnt, nInts);
+ SetLength(cumPcnt, nInts);
+ Setlength(pcntileRank, nInts);
// Get frequency of cases in each interval
nCases := 0;
@@ -239,7 +238,7 @@ begin
pcnt[0] := freq[0] / nCases;
cumPcnt[0] := cumFreq[0] / nCases;
pcntileRank[0] := (freq[0] * 0.5) / nCases;
- for k := 1 to nInts - 1do
+ for k := 1 to nInts - 1 do
begin
cumfreq[k] := cumfreq[k-1] + freq[k];
pcnt[k] := freq[k] / nCases;