bef091e83b448dafc5c601fab3d04eb0d60f19f6
[pspp-builds.git] / src / math / box-whisker.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2008, 2009 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 "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
31 struct outlier
32 {
33   double value;
34   struct string label;
35   bool extreme;
36   struct ll ll;
37 };
38
39
40 struct box_whisker
41 {
42   struct order_stats parent;
43
44   double hinges[3];
45   double whiskers[2];
46
47   struct ll_list outliers;
48
49   double step;
50
51   size_t casenumber_idx;
52   const struct variable *id_var;
53 };
54
55 struct box_whisker * box_whisker_create (const struct tukey_hinges *,
56                                          const struct variable *, size_t);
57
58 void box_whisker_whiskers (const struct box_whisker *bw, double whiskers[2]);
59
60 void box_whisker_hinges (const struct box_whisker *bw, double hinges[2]);
61
62 const struct ll_list * box_whisker_outliers (const struct box_whisker *bw);
63
64
65 #endif