Merge commit 'origin/stable'
[pspp-builds.git] / src / math / group.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2004 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
18 #ifndef GROUP_H
19 #define GROUP_H
20
21 #include <data/value.h>
22
23 /* Statistics for grouped data */
24 struct group_statistics
25   {
26     /* The value of the independent variable for this group */
27     union value id;
28
29     /* The arithmetic mean */
30     double mean;
31
32     /* Population std. deviation */
33     double std_dev;
34
35     /* Sample std. deviation */
36     double s_std_dev;
37
38     /* count */
39     double n;
40
41     double sum;
42
43     /* Sum of squares */
44     double ssq;
45
46     /* Std Err of Mean */
47     double se_mean;
48
49     /* Sum of differences */
50     double sum_diff;
51
52     /* Mean of differences */
53     double mean_diff ;
54
55     /* Running total of the Levene for this group */
56     double lz_total;
57
58     /* Group mean of Levene */
59     double lz_mean;
60
61
62     /* min and max values */
63     double minimum ;
64     double maximum ;
65   };
66
67
68 struct variable ;
69
70 /* These funcs are useful for hash tables */
71
72 /* Return -1 if the id of a is less than b; +1 if greater than and
73    0 if equal */
74 int  compare_group (const void *a,
75                     const void *b,
76                     const void *var);
77
78 unsigned int hash_group (const void *g, const void *var);
79
80 void  free_group (struct group_statistics *v, void *aux);
81
82
83
84 #endif