6d4691e7b74f003ab2079e589c0797d3f1acd410
[pspp-builds.git] / src / math / group.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2004 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    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, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19
20 #ifndef GROUP_H
21 #define GROUP_H
22
23
24 #include <data/value.h>
25
26
27 /* Statistics for grouped data */
28 struct group_statistics
29   {
30     /* The value of the independent variable for this group */
31     union value id;
32
33     /* The arithmetic mean */
34     double mean;
35
36     /* Population std. deviation */
37     double std_dev;
38
39     /* Sample std. deviation */
40     double s_std_dev;
41
42     /* count */
43     double n;
44
45     double sum;
46
47     /* Sum of squares */
48     double ssq;
49
50     /* Std Err of Mean */
51     double se_mean;
52
53     /* Sum of differences */
54     double sum_diff;
55
56     /* Mean of differences */
57     double mean_diff ;
58
59     /* Running total of the Levene for this group */
60     double lz_total;
61
62     /* Group mean of Levene */
63     double lz_mean;
64
65
66     /* min and max values */
67     double minimum ;
68     double maximum ;
69
70
71   };
72
73
74
75
76 /* These funcs are useful for hash tables */
77
78 /* Return -1 if the id of a is less than b; +1 if greater than and
79    0 if equal */
80 int  compare_group(const struct group_statistics *a,
81                    const struct group_statistics *b,
82                    int width);
83
84 unsigned hash_group(const struct group_statistics *g, int width);
85
86 void  free_group(struct group_statistics *v, void *aux);
87
88
89
90 #endif