Home / Statistical Tools / Analysis Tools / Barchart / Math Details
Math Details¶
Under review: candidate for removal
The Bar Chart is primarily a visualization tool; the only non-trivial formula is the sample standard deviation option. This page is flagged for review: it may be removed if judged too thin to warrant a Math Details page.
This page gives the formulas Quantum XL uses when a Bar Chart aggregates numeric data. Each bar's height is one of the aggregation functions below (chosen in Options).
Notation¶
| Term | Description |
|---|---|
| \(x_i, w_i\) | value in a category and its frequency weight (\(w_i = 1\) when no frequency column is used) |
| \(n\) | effective count in the category, \(n = \sum_i w_i\) |
| \(\bar{x}\) | weighted mean of the category |
Aggregation functions¶
| Function | Bar height |
|---|---|
| Sum | \(\sum_i w_i x_i\) |
| Count | \(n = \sum_i w_i\) |
| Mean | \(\bar{x} = \dfrac{\sum_i w_i x_i}{\sum_i w_i}\) |
| Minimum / Maximum | smallest / largest \(x_i\) in the category |
| Median | the \(0.5\) quantile (Hyndman-Fan Type 8) |
Median¶
The median bar height is the \(0.5\) quantile of the category's values, computed with the shared Type 8 estimator applied to the frequency-weighted values:
where \(x_{(1)} \le \cdots \le x_{(n)}\) are the \(n\) data values sorted ascending and \(\lfloor h \rfloor\) is the greatest integer not exceeding \(h\). The two indices are clamped to the range \([1, n]\) and the interpolation weight \(h - \lfloor h \rfloor\) is clamped to \([0, 1]\), so the ends behave as \(Q(0) = x_{(1)}\) (the minimum) and \(Q(1) = x_{(n)}\) (the maximum).
When each value carries a frequency \(f_i\), Quantum XL applies the same estimator to the virtual sample formed by repeating each value \(f_i\) times, without physically expanding it. The total count is \(N = \sum_i f_i\), and the position becomes:
Let \(V(t)\) be the value at position \(t\) of the sorted virtual sample, that is the smallest value whose cumulative frequency reaches \(t\). The quantile is:
with the same end clamping. This gives exactly the result of expanding the data and applying the unweighted formula.
Full details: Type 8 (Hyndman-Fan) Quantiles.
Sample standard deviation¶
The other non-elementary option:
Uses the \(n-1\) (Bessel) denominator; returned as blank when \(n \le 1\).
Shared Math Details used here¶
This tool uses shared formulas defined once in Shared Math Details. See those pages for the exact definitions.
| Shared concept | Used here for | Reference |
|---|---|---|
| Type 8 quantiles | the median bar height | Type 8 (Hyndman-Fan) Quantiles |
See Also¶
References¶
- Snedecor, G. W., & Cochran, W. G. (1989). Statistical Methods (8th ed.). Ames, IA: Iowa State University Press.
- Montgomery, D. C. (2013). Introduction to Statistical Quality Control (7th ed.). Hoboken, NJ: John Wiley & Sons.