YOUSEFUL / DELPHI / COMPONENTS
TAtlasBoxStats
Box plot statistics of one sample: count, quartiles, mean, whiskers and outliers.
Description
Returned by TAtlasStats.Box and by TAtlasBoxPlot.Stats. Quartiles use linear interpolation between closest ranks. The whiskers start at the box and extend to the most extreme values within 1.5 IQR (Q3 - Q1) of it, so a sample whose extremes are all outliers still gets zero-length whiskers.
Members
| Member | Kind | What it does |
|---|---|---|
Count | field | Number of values in the sample. |
Minimum | field | Smallest value, outliers included. |
Q1 | field | First quartile (the 0.25 quantile). |
Median | field | The 0.5 quantile; the average of the middle pair for an even count. |
Q3 | field | Third quartile (the 0.75 quantile). |
Maximum | field | Largest value, outliers included. |
Mean | field | Arithmetic mean of all values, outliers included. |
LowWhisker | field | The smallest value not below Q1 - 1.5 * (Q3 - Q1), or Q1 if there is none. |
HighWhisker | field | The largest value not above Q3 + 1.5 * (Q3 - Q1), or Q3 if there is none. |
Outliers | field | Values beyond the whisker limits, in ascending order; empty when there are none. |
Fields
Count field
Count: Integer;Number of values in the sample.
Minimum field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;Smallest value, outliers included.
Q1 field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;First quartile (the 0.25 quantile).
Median field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;The 0.5 quantile; the average of the middle pair for an even count.
Q3 field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;Third quartile (the 0.75 quantile).
Maximum field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;Largest value, outliers included.
Mean field
Minimum, Q1, Median, Q3, Maximum, Mean: Double;Arithmetic mean of all values, outliers included.
LowWhisker field
LowWhisker, HighWhisker: Double;The smallest value not below Q1 - 1.5 * (Q3 - Q1), or Q1 if there is none.
HighWhisker field
LowWhisker, HighWhisker: Double;The largest value not above Q3 + 1.5 * (Q3 - Q1), or Q3 if there is none.
Outliers field
Outliers: TArray<Double>;Values beyond the whisker limits, in ascending order; empty when there are none. TAtlasBoxHit.Outlier indexes this array.
Examples
Flag slow requests
Lists the outliers of a sample.
uses
System.SysUtils, System.Classes, Atlas.PlotStats;
procedure ListSlowRequests(const Times: TArray<Double>; Target: TStrings);
var Stats: TAtlasBoxStats; Value: Double;
begin
Stats := TAtlasStats.Box(Times);
Target.Add(Format('%d requests, typical %.0f to %.0f ms', [Stats.Count, Stats.Q1, Stats.Q3]));
for Value in Stats.Outliers do
if Value > Stats.HighWhisker then Target.Add(Format('slow: %.0f ms', [Value]));
end;