EXAMINE: Complete re-implementation
[pspp] / src / math / box-whisker.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef __MATH_BOX_WHISKER_H__
18 #define __MATH_BOX_WHISKER_H__
19
20 #include <stddef.h>
21 #include "libpspp/ll.h"
22 #include "libpspp/str.h"
23 #include "math/order-stats.h"
24
25 /* This module calculates the statistics typically displayed by box-plots.
26    However, there's no reason not to use it for other purposes too.
27  */
28 struct tukey_hinges;
29
30 struct outlier
31 {
32   double value;
33   struct string label;
34   bool extreme;
35   struct ll ll;
36 };
37
38
39 struct box_whisker
40 {
41   struct order_stats parent;
42
43   double hinges[3];
44   double whiskers[2];
45
46   struct ll_list outliers;
47
48   double step;
49
50   size_t casenumber_idx;
51 };
52
53 struct box_whisker * box_whisker_create (const struct tukey_hinges *,
54                                          size_t);
55
56 void box_whisker_whiskers (const struct box_whisker *bw, double whiskers[2]);
57
58 void box_whisker_hinges (const struct box_whisker *bw, double hinges[2]);
59
60 const struct ll_list * box_whisker_outliers (const struct box_whisker *bw);
61
62
63 #endif